Wire Sysio
Wire Sysion 1.0.0
Loading...
Searching...
No Matches
simpledom.cpp
Go to the documentation of this file.
1
// JSON simple example
2
// This example does not handle errors.
3
4
#include "
rapidjson/document.h
"
5
#include "
rapidjson/writer.h
"
6
#include "
rapidjson/stringbuffer.h
"
7
#include <iostream>
8
9
using namespace
rapidjson
;
10
11
int
main
() {
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
}
GenericDocument< UTF8<> >
GenericStringBuffer< UTF8< char >, CrtAllocator >
GenericStringBuffer::GetString
const Ch * GetString() const
Definition
stringbuffer.h:73
GenericValue< UTF8<> >
Writer
JSON writer.
Definition
writer.h:89
document.h
rapidjson
main RapidJSON namespace
main
int main()
Definition
simpledom.cpp:11
stringbuffer.h
writer.h
d
CK_ULONG d
Definition
yubihsm_pkcs11.c:1238
s
char * s
Definition
yubihsm_pkcs11.c:524
libraries
fc
include
fc
crypto
webauthn_json
example
simpledom
simpledom.cpp
Generated by
1.12.0