MCPcopy Create free account
hub / github.com/couchbase/fleece / FLJSON5_ToJSON

Function FLJSON5_ToJSON

Fleece/API_Impl/Fleece.cc:154–176  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

152
153
154FLStringResult FLJSON5_ToJSON(FLString json5,
155 FLStringResult *outErrorMessage, size_t *outErrorPos,
156 FLError *error) FLAPI {
157 alloc_slice errorMessage;
158 size_t errorPos = 0;
159 try {
160 std::string json = ConvertJSON5((std::string((char*)json5.buf, json5.size)));
161 return toSliceResult(alloc_slice(json));
162 } catch (const json5_error &x) {
163 errorMessage = alloc_slice(x.what());
164 errorPos = x.inputPos;
165 if (error)
166 *error = kFLJSONError;
167 } catch (const std::exception &x) {
168 errorMessage = alloc_slice(x.what());
169 recordError(x, error);
170 }
171 if (outErrorMessage)
172 *outErrorMessage = toSliceResult(std::move(errorMessage));
173 if (outErrorPos)
174 *outErrorPos = errorPos;
175 return {};
176}
177
178
179FLSliceResult FLData_Dump(FLSlice data) FLAPI {

Callers

nothing calls this directly

Calls 4

ConvertJSON5Function · 0.85
toSliceResultFunction · 0.85
recordErrorFunction · 0.85
alloc_sliceFunction · 0.50

Tested by

no test coverage detected