forked from AlexeyAB/darknet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstring_buffer.cpp
39 lines (26 loc) · 859 Bytes
/
string_buffer.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include "rapidjson/writer.h"
#include "rapidjson/stringbuffer.h"
#include <iostream>
using namespace rapidjson;
using namespace std;
int main() {
StringBuffer s;
Writer<StringBuffer> writer(s);
writer.StartObject();
writer.Key("url");
writer.String("some.jpg");
writer.Key("response");
writer.StartObject();
writer.Key("annotations");
writer.StartArray();
writer.StartObject();
writer.Key("width");
writer.Uint(325);
writer.EndObject();
writer.EndArray();
writer.EndObject();
writer.EndObject();
cout << s.GetString() << endl;
return 0;
}
//json = { "url": "some.jpg", "response":{ "annotations": [{ "width":325 }]}}