FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
sonic-cpp/example/parse_schema.cpp at master · bytedance/sonic-cpp · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
bytedance
/
sonic-cpp
Public
Notifications
You must be signed in to change notification settings
Fork
127
Star
976
Code
Issues
30
Pull requests
14
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
sonic-cpp
/
example
/
parse_schema.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
28 lines (23 loc) · 629 Bytes
Breadcrumbs
sonic-cpp
/
example
/
parse_schema.cpp
Copy path
File metadata and controls
28 lines (23 loc) · 629 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
#
include
<
iostream
>
#
include
<
string
>
#
include
<
vector
>
#
include
"
sonic/sonic.h
"
int
main
() {
std::string json_schema =
R"(
{"obj":1}
)"
;
std::string json =
R"(
{"it":1, "obj":{"a":{"b":1}, "b":[1]}}
)"
;
sonic_json::Document doc;
doc.
Parse
(json_schema);
if
(doc.
HasParseError
()) std::cout <<
"
error
\n
"
;
//
doc.Parse(json_schema);
doc.
ParseSchema
(json);
if
(doc.
HasParseError
()) {
std::cout <<
"
json:
"
<< json.
substr
(doc.
GetErrorOffset
()) << std::endl;
}
std::cout <<
"
schema :
"
<< doc.
Dump
() << std::endl;
}
//
g++ -I../include/ -march=haswell --std=c++11 parse_schema.cpp -o
//
parse_schema
Back
|
FazBrowse Home
|
New Git URL