Couchbase Lite C
Couchbase Lite C API
|
These are convenience functions that directly return JSON-encoded output. More...
Functions | |
FLStringResult | FLValue_ToJSON (FLValue) |
Encodes a Fleece value as JSON (or a JSON fragment.) Any Data values will become base64-encoded JSON strings. More... | |
FLStringResult | FLValue_ToJSON5 (FLValue v) |
Encodes a Fleece value as JSON5, a more lenient variant of JSON that allows dictionary keys to be unquoted if they're alphanumeric. More... | |
FLStringResult | FLValue_ToJSONX (FLValue v, bool json5, bool canonicalForm) |
Most general Fleece to JSON converter. More... | |
FLStringResult | FLJSON5_ToJSON (FLString json5, FLStringResult *outErrorMessage, size_t *outErrorPos, FLError *outError) |
Converts valid JSON5 https://json5.org to JSON. More... | |
Debugging Functions | |
const char * | FLDump (FLValue) |
Debugging function that returns a C string of JSON. More... | |
const char * | FLDumpData (FLSlice data) |
Debugging function that returns a C string of JSON. More... | |
These are convenience functions that directly return JSON-encoded output.
For more control over the encoding, use an FLEncoder.
const char * FLDump | ( | FLValue | ) |
Debugging function that returns a C string of JSON.
Does not free the string's memory!
const char * FLDumpData | ( | FLSlice | data | ) |
Debugging function that returns a C string of JSON.
Does not free the string's memory!
FLStringResult FLJSON5_ToJSON | ( | FLString | json5, |
FLStringResult * | outErrorMessage, | ||
size_t * | outErrorPos, | ||
FLError * | outError | ||
) |
Converts valid JSON5 https://json5.org to JSON.
Among other things, it converts single quotes to double, adds missing quotes around dictionary keys, removes trailing commas, and removes comments.
json5 | The JSON5 to parse |
outErrorMessage | On failure, the error message will be stored here (if not NULL.) As this is a FLStringResult, you will be responsible for freeing it. |
outErrorPos | On a parse error, the byte offset in the input where the error occurred will be stored here (if it's not NULL.) |
outError | On failure, the error code will be stored here (if it's not NULL.) |
FLStringResult FLValue_ToJSON | ( | FLValue | ) |
Encodes a Fleece value as JSON (or a JSON fragment.) Any Data values will become base64-encoded JSON strings.
FLStringResult FLValue_ToJSON5 | ( | FLValue | v | ) |
Encodes a Fleece value as JSON5, a more lenient variant of JSON that allows dictionary keys to be unquoted if they're alphanumeric.
This tends to be more readable.
FLStringResult FLValue_ToJSONX | ( | FLValue | v, |
bool | json5, | ||
bool | canonicalForm | ||
) |
Most general Fleece to JSON converter.