mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2024-12-28 18:46:18 +00:00
u/json: Add json getter
u_json_get() is much, much shorter than cJSON_GetObjectItemCaseSensitive().
This commit is contained in:
parent
e3b74c2e70
commit
74a328e909
|
@ -27,6 +27,12 @@ get(const cJSON *json, const char *f)
|
|||
return cJSON_GetObjectItemCaseSensitive(json, f);
|
||||
}
|
||||
|
||||
const cJSON *
|
||||
u_json_get(const cJSON *json, const char *f)
|
||||
{
|
||||
return get(json, f);
|
||||
}
|
||||
|
||||
bool
|
||||
u_json_get_string_into_array(const cJSON *json, char *out_str, size_t max_size)
|
||||
{
|
||||
|
|
|
@ -20,6 +20,13 @@
|
|||
extern "C" {
|
||||
#endif // __cplusplus
|
||||
|
||||
/*!
|
||||
* @brief Get a JSON object by string from a JSON object.
|
||||
*
|
||||
* @return The JSON object with the given name if successful, NULL if not.
|
||||
*/
|
||||
const cJSON *
|
||||
u_json_get(const cJSON *json, const char *f);
|
||||
|
||||
/*!
|
||||
* @brief Parse a string from a JSON object into a char array.
|
||||
|
|
Loading…
Reference in a new issue