This is a small library aiming to be a very simple way to work with JSON objects in C++.
It ibrary allows the programmer to:
- Parse JSON objects (from strings) and make them accessible as C++ JPP objects.
- Build JSON objects (as strings) from C++ JPP objects.
By Diego Tames Vargas.
const jpp::JSON obj;
obj[ "name" ] = "Diego";
obj[ "lastname" ] = "Tames Vargas";
obj[ "job" ] = "Crazy Programmer!";
std::cout << "JSON: " << obj.toString() << std::endl;
Output:
{"name":"Diego","lastname":"Tames Vargas","job":"Crazy Programmer!"}
const jpp::JSON obj( "{\"name\":\"Diego\",\"lastname\":\"Tames Vargas\",\"job\":\"Crazy Programmer!\"}" );
std::cout << "Name: " << obj[ "name" ].getString() << std::endl;
std::cout << "Lastname: " << obj[ "lastname" ].getString() << std::endl;
std::cout << "Job: " << obj[ "job" ].getString() << std::endl;
Output:
Name: Diego
Lastname: Tames Vargas
Job: Crazy Programmer!