Squashed 'deps/ox/deps/jsoncpp/' content from commit 5defb4ed
git-subtree-dir: deps/ox/deps/jsoncpp git-subtree-split: 5defb4ed1a4293b8e2bf641e16b156fb9de498cc
This commit is contained in:
23
example/streamWrite/streamWrite.cpp
Normal file
23
example/streamWrite/streamWrite.cpp
Normal file
@ -0,0 +1,23 @@
|
||||
#include "json/json.h"
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
/** \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;
|
||||
}
|
Reference in New Issue
Block a user