A simple and complete json parser
This parser makes use of all the functions which reads the value of a json object. This parser is complete in all respects. You can make use of the functions to create parser for your various requirements #include <json/json.h> #include <stdio.h> /*printing the value corresponding to boolean, double, integer and strings*/ void print_json_value(json_object *jobj){ enum [...]
json_object_array_put_idx- Add json object to Array at specified index
json_object_array_add is used to add a json object to an array. Using json_object_array_put_idx, we can put a json object at a specified index The syntax of the function is int json_object_array_put_idx (struct json_object *this, int idx, struct json_object *val) Specify the object where the json object has to be added, index and the value (json [...]
json_object_array_add- Add json object to Array
json_object_array is used to add a json object to an array The syntax of the function is int json_object_array_add (struct json_object *this, struct json_object *val) Specify the object where the json object has to be added, key and the value (json object) as the arguments The following program shows the usage of the function #include [...]
json_object_new_array- Create a new array json object
json_object_new_array is used to create a new array json object. The syntax of the function is json_object * json_object_new_array (char *s) Specify the array as the argument and it returns a pointer to the json object The following program shows the usage of the function #include <json/json.h> #include <stdio.h> int main() { /*Creating a json [...]
json_object_new_double- Create a new double json object
json_object_new_double is used to create a new double json object. The syntax of the function is json_object * json_object_new_double (char *s) Specify the double as the argument and it returns a pointer to the json object The following program shows the usage of the function #include <json/json.h> #include <stdio.h> int main() { /*Creating a json [...]
json_object_new_string- Create a new string json object
json_object_new_string is used to create a new string json object. The syntax of the function is json_object * json_object_new_string (char *s) Specify the string as the argument and it returns a pointer to the json object The following program shows the usage of the function #include <json/json.h> #include <stdio.h> int main() { /*Creating a json [...]
json_object_new_boolean- Create a new boolean json object
json_object_new_boolean is used to create a new boolean json object. The syntax of the function is json_object * json_object_new_boolean (boolean b) A non-zero value can be considered as boolean true As you can see, it returns a pointer to the json object The following program shows the usage of the function #include <json/json.h> #include <stdio.h> [...]