Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct json_object *new_obj = NULL;
- new_obj = json_tokener_parse(strRawJSON);
- new_obj = json_object_object_get(new_obj, "FUU");
- if(NULL == new_obj){
- SYS_OUT("nFUU not found in JSON");
- return NO;
- }
- new_obj = json_object_object_get(new_obj, "FOO"); // I m re-using new_obj, without free it?
- if(NULL == new_obj){
- SYS_OUT("nFOO not found in JSON");
- return NO;
- }
- // DO I need to clean new_obj, if yes then how ??
- struct json_object *new_obj, *fuu_obj, *foo_obj;
- new_obj = json_tokener_parse(strRawJSON);
- fuu_obj = json_object_object_get(new_obj, "FUU");
- if(NULL == new_obj){
- SYS_OUT("nFUU not found in JSON");
- return NO;
- }
- foo_obj = json_object_object_get(new_obj, "FOO");
- if(NULL == new_obj){
- SYS_OUT("nFOO not found in JSON");
- return NO;
- }
- json_object_put(foo_obj);
- json_object_put(fuu_obj);
- json_object_put(new_obj);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement