You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
500 B
23 lines
500 B
#include "json/json.h"
|
|
#include <iostream>
|
|
/** \brief Write the Value object to a stream.
|
|
* Example Usage:
|
|
* $g++ streamWrite.cpp -ljsoncpp -std=c++11 -o streamWrite
|
|
* $./streamWrite
|
|
* {
|
|
* "Age" : 20,
|
|
* "Name" : "robin"
|
|
* }
|
|
*/
|
|
int main() {
|
|
Json::Value root;
|
|
Json::StreamWriterBuilder builder;
|
|
const std::unique_ptr<Json::StreamWriter> writer(builder.newStreamWriter());
|
|
|
|
root["Name"] = "robin";
|
|
root["Age"] = 20;
|
|
writer->write(root, &std::cout);
|
|
|
|
return EXIT_SUCCESS;
|
|
}
|