Standalone C++ program to create the JSON for one XML output using rapidjson.

Rapidjson is a C++ JSON parser and generator. In other words, it helps a C++ program to read JSON data and write JSON data.
rapidjson supports SAX (Simple API for XML) style and DOM (Document Object Model) for parsing.

(rapidjson is a header-only library. That means, the only thing to be done is to copy rapidjson/include/rapidjson and its sub-directories to your project or other include paths.)
the steps mentioned below are for the Mint distribution-

The rapidjson package can be downloaded from here – . It can then be unpacked.
(considering that the folder containing the installed rapidjson is ‘rapidjson’)

before proceeding, certain libraries need to be installed, which can be done by-
$sudo apt-get install gcc-multilib g++-multilib

now, run GNU make in build/gmake,(inside ‘rapidjson’) for example-
$make -f test.make config=release32
$make -f example.make config=debug32

On success, the executable are generated at rapidjson/bin

inside the ‘include’ sub-folder (in rapidjson), a file (let’s say, prog1.cpp) containing the following c++ code is to be added –

#include "rapidjson/document.h"

int main() {
const char json[] = “{ \”hello\” : \”world\” }”;

rapidjson::Document d;

printf(“%s\n”, d[“hello”].GetString());

return 0;
(the document.h header file can be found inside ‘rapidjson/include/rapidjson’)

In order to compile this code, on the terminal type the command-
$g++ test1.cpp
Once the code has been successfully compiled without any errors, the executables for the same can be created using-
which gives the output –

This example parses a JSON text string into a DOM tree. Then it obtains the “hello” member of the root JSON object. Finally it obtains the string of that value, which is “world”.