|
Tchatator413
TripEnArvor instant messaging protocol - JSON-based
|
JSON-C library extra functions - Interface. More...
Go to the source code of this file.
Macros | |
| #define | min_json(obj) json_object_to_json_string_ext(obj, JSON_C_TO_STRING_PLAIN) |
| Create a minified JSON string from a JSON object. | |
| #define | json_object_dbg_print(obj) fprintf(stderr, "json_object_dbg_print: %s\n", json_object_to_json_string_ext(obj, JSON_C_TO_STRING_PRETTY)) |
| Debug-print a JSON object. | |
| #define | LOG_FMT_JSON_C(fmt, ...) "json-c: " fmt ": %s" __VA_OPT__(, ) __VA_ARGS__, json_util_get_last_err() |
| A format string and arguments for a json-c error. | |
| #define | LOG_FMT_JSON_TYPE(type, actual, fmt, ...) "json: " fmt ": type: expected %s, got %s\n" __VA_OPT__(, ) __VA_ARGS__, json_type_to_name(type), json_type_to_name(actual) |
| A format string and arguments for a JSON type error. | |
Functions | |
| bool | json_object_get_uint16_strict (json_object const *obj, uint16_t *out) |
| Get the 16-bit unsigned integer value of a JSON object. | |
| bool | json_object_get_int_strict (json_object const *obj, int32_t *out) |
| Get the 32-bit integer value of a JSON object. | |
| bool | json_object_get_int64_strict (json_object const *obj, int64_t *out) |
| Get the 64-bit integer value of a JSON object. | |
| bool | json_object_get_string_strict (json_object *obj, slice_t *out) |
| Get the string value of a JSON object. | |
| #define json_object_dbg_print | ( | obj | ) | fprintf(stderr, "json_object_dbg_print: %s\n", json_object_to_json_string_ext(obj, JSON_C_TO_STRING_PRETTY)) |
Debug-print a JSON object.
Definition at line 18 of file json-helpers.h.
| #define LOG_FMT_JSON_C | ( | fmt, | |
| ... | |||
| ) | "json-c: " fmt ": %s" __VA_OPT__(, ) __VA_ARGS__, json_util_get_last_err() |
A format string and arguments for a json-c error.
Definition at line 22 of file json-helpers.h.
| #define LOG_FMT_JSON_TYPE | ( | type, | |
| actual, | |||
| fmt, | |||
| ... | |||
| ) | "json: " fmt ": type: expected %s, got %s\n" __VA_OPT__(, ) __VA_ARGS__, json_type_to_name(type), json_type_to_name(actual) |
A format string and arguments for a JSON type error.
Definition at line 25 of file json-helpers.h.
| #define min_json | ( | obj | ) | json_object_to_json_string_ext(obj, JSON_C_TO_STRING_PLAIN) |
Create a minified JSON string from a JSON object.
Definition at line 15 of file json-helpers.h.
| bool json_object_get_int64_strict | ( | json_object const * | obj, |
| int64_t * | out | ||
| ) |
Get the 64-bit integer value of a JSON object.
| obj | The JSON object to get the value of. |
| out | Assigned to the integer value of the object. Pass NULL to only check the type. |
true when obj is of the integer type. false otherwise. out is untouched. | bool json_object_get_int_strict | ( | json_object const * | obj, |
| int32_t * | out | ||
| ) |
Get the 32-bit integer value of a JSON object.
| obj | The JSON object to get the value of. |
| out | Assigned to the integer value of the object. Pass NULL to only check the type. |
true when obj is of the integer type. false otherwise. out is untouched. | bool json_object_get_string_strict | ( | json_object * | obj, |
| slice_t * | out | ||
| ) |
Get the string value of a JSON object.
| obj | The JSON object to get the value of. |
| out | Assigned to the string value of the object. Pass NULL to only check the type. The returned slice is null-terminated, but the null terminator is not included in the length. |
true when obj is of the string type. false otherwise. out is untouched. | bool json_object_get_uint16_strict | ( | json_object const * | obj, |
| uint16_t * | out | ||
| ) |
Get the 16-bit unsigned integer value of a JSON object.
| obj | The JSON object to get the value of. |
| out | Assigned to the integer value of the object. Pass NULL to only check the type. |
true when obj is of the integer type. false otherwise. out is untouched. 0 and UINT16_MAX.