json-c / libjson Tutorial with Examples
JSON is a data inter-exchange format. When compared to XML, it is very lightweight and more human-readable. The Data representation has some what a similar representation like C/C++ structures. It is nowadays very heavily used data format for data transfer in the web. Most languages like PHP have functions to manipulate JSON data. In case of C/C++, there are many libraries like json-c, json-glibc, jsoncpp.
- Introduction to JSON
- json-c: Installation
- Other libraries: json-glib: Installation
- Compiling a json-c program
- A simple and Complete Json Parser
- Working with json objects: Getting the type and browsing each json object
- Getting the value of a json object
-
Creating a new json object: Integers, Booleans, Strings
- Json: json_object_new_object : Creating a new json object
- Integers: json_object_new_int: Creating an integer json object
- Booleans: json_object_new_boolean: Creating a boolean json object
- Strings: json_object_new_string: Creating a stringjson object
- Double(Floating Point Numbers): json_object_new_double: Creating a double json object
- Arrays: json_object_new_array: Creating an array json object
- Working with arrays
Hope you found this tutorial useful. Please leave your valuable comments.
Comments:
Could really use a tutorial on how to get things by the key. Say I named a key SuperPower. I want to find wherever SuperPower is inside of my object and then return that value.