Skip to main content

Posts

Showing posts from October, 2014

Serializing & Deserializing JSON Object [ C++ ]

         This is sample code for serializing an object into json object and deserializing it back into earlier object. Things to keep in mind : While creating a json object, you have to write  json_object* jObj=json_object_new_object();   initializing it as   json_object* jObj ;   will not work. You need to install JSON library using  $ sudo apt-get install libjson0 libjson0-dev, Check path of installed json here   $ ls /usr/include/json You need to add json library to linker or compiler path. For ex. in Eclipse , Right click on project >> properties >> path and symbols. Add /usr/include/json in library paths & json in libraries. //============================================================================ // Name : JsonTest.cpp // Author : Manish Kumar Khedawat //============================================================================ #include <iostream> #include <json...