From the course: Exploring C Libraries

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Accessing JSON data

Accessing JSON data - C Tutorial

From the course: Exploring C Libraries

Start my 1-month free trial

Accessing JSON data

- [Instructor] Central to manipulating json data with a json C library is creating a json object. It can be extracted from json data stored in a file, or from a string representing json data within the source code. In this code, a sample json document is open, its file name specified at line seven. At line 12, a json object is created from the file, saved in the json object variable, jdata. Here, only the object is created and nothing is done with it, but I'm going to compile and link, just to make sure that it works. So the command is clang, that's the name of the compiler. You can use gcc or cc. Going to add all the switches, link in the json c library, and type the source code name. And the file compiles with no errors or warnings, so run to check the output. And there reports that the file was read and the json object was successfully created. In this update to the code, the json data stored in the json object jdata…

Contents