Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
simpledom.cpp File Reference
#include "rapidjson/document.h"
#include "rapidjson/writer.h"
#include "rapidjson/stringbuffer.h"
#include <iostream>
Include dependency graph for simpledom.cpp:

Go to the source code of this file.

Functions

int main ()
 

Function Documentation

◆ main()

int main ( void )

Definition at line 11 of file simpledom.cpp.

11 {
12 // 1. Parse a JSON string into DOM.
13 const char* json = "{\"project\":\"rapidjson\",\"stars\":10}";
14 Document d;
15 d.Parse(json);
16
17 // 2. Modify it by DOM.
18 Value& s = d["stars"];
19 s.SetInt(s.GetInt() + 1);
20
21 // 3. Stringify the DOM
22 StringBuffer buffer;
23 Writer<StringBuffer> writer(buffer);
24 d.Accept(writer);
25
26 // Output {"project":"rapidjson","stars":11}
27 std::cout << buffer.GetString() << std::endl;
28 return 0;
29}
const Ch * GetString() const
JSON writer.
Definition writer.h:89
CK_ULONG d
char * s
Here is the call graph for this function: