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
- [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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
Understanding XML2m 23s
-
(Locked)
Testing the libxml2 installation3m 10s
-
(Locked)
Accessing XML data3m 26s
-
(Locked)
Generating XML data3m 57s
-
(Locked)
Working with JSON2m 39s
-
(Locked)
Testing the json-c installation3m 17s
-
(Locked)
Accessing JSON data3m 10s
-
(Locked)
Reading JSON data3m 46s
-
(Locked)
Creating JSON output3m 35s
-
-
-
-
-