Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
json
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
json
Commits
4f0afbbe
Commit
4f0afbbe
authored
Jan 05, 2015
by
Niels
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added note from
http://isocpp.org/blog/2015/01/json-for-modern-cpp
parent
f0582a8b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
0 deletions
+7
-0
README.md
README.md
+3
-0
json_unit.cc
test/json_unit.cc
+4
-0
No files found.
README.md
View file @
4f0afbbe
...
...
@@ -110,6 +110,9 @@ You can create an object (deserialization) by appending `_json` to a string lite
```
cpp
// create object from string literal
json
j
=
"{
\"
pi
\"
: 3.141,
\"
happy
\"
: true }"
_json
;
// or even nicer (thanks http://isocpp.org/blog/2015/01/json-for-modern-cpp)
auto
j2
=
R"( {"pi": 3.141, "happy": true} )"
_json
;
```
You can also get a string representation (serialize):
...
...
test/json_unit.cc
View file @
4f0afbbe
...
...
@@ -1775,6 +1775,10 @@ TEST_CASE("Parser")
auto
j3
=
"{
\"
key
\"
:
\"
value
\"
}"
_json
;
CHECK
(
j3
[
"key"
]
==
"value"
);
auto
j22
=
R"({"pi": 3.141, "happy": true })"
_json
;
auto
j23
=
"{
\"
pi
\"
: 3.141,
\"
happy
\"
: true }"
_json
;
CHECK
(
j22
==
j23
);
}
SECTION
(
"Errors"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment