Looking at the code I think it is better to change the prototype of:
``` str _json_extract_field(struct json_object *json_obj, char *json_name) ```
to:
``` int _json_extract_field(struct json_object *json_obj, char *json_name, str *val) ```
Now it returns a variable declared on the stack, which could work with recent compilers, being returned by value. `str` itself is not a large structure, but returning structure values is not recommended in C, code analyzers complain about (same for passing a structure value as parameter -- it is recommended to use pointers).