created get_string_from_json_string function

This commit is contained in:
Václav Šmejkal 2023-03-25 16:36:09 +01:00
parent 885b99b7a8
commit 259a9e7c82
Signed by: ENGO150
GPG Key ID: 4A57E86482968843

View File

@ -158,6 +158,17 @@ char *get_string_from_json(struct json_object *json, char *string)
struct json_object *object; struct json_object *object;
json_object_object_get_ex(json, string, &object); json_object_object_get_ex(json, string, &object);
return (char*) json_object_get_string(object);
}
char *get_string_from_json_string(char *json, char *string)
{
struct json_object *json_obj = json_tokener_parse(json);
char *returning = get_string_from_json(json_obj, string);
//DEALLOCATION
json_object_put(json_obj);
//GET STRINGS //GET STRINGS
return returning; return returning;
} }