Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
json
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
json
Commits
08456b8f
Commit
08456b8f
authored
Jan 06, 2015
by
Niels
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
minor changes
parent
d84f8ebb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
2 deletions
+9
-2
README.md
README.md
+5
-1
test/json_unit.cc
test/json_unit.cc
+4
-1
No files found.
README.md
View file @
08456b8f
...
@@ -115,7 +115,11 @@ You can create an object (deserialization) by appending `_json` to a string lite
...
@@ -115,7 +115,11 @@ You can create an object (deserialization) by appending `_json` to a string lite
json
j
=
"{
\"
pi
\"
: 3.141,
\"
happy
\"
: true }"
_json
;
json
j
=
"{
\"
pi
\"
: 3.141,
\"
happy
\"
: true }"
_json
;
// or even nicer (thanks http://isocpp.org/blog/2015/01/json-for-modern-cpp)
// or even nicer (thanks http://isocpp.org/blog/2015/01/json-for-modern-cpp)
auto
j2
=
R"( {"pi": 3.141, "happy": true} )"
_json
;
auto
j2
=
R"(
{
"pi": 3.141,
"happy": true
})"
_json
;
```
```
You can also get a string representation (serialize):
You can also get a string representation (serialize):
...
...
test/json_unit.cc
View file @
08456b8f
...
@@ -1778,7 +1778,10 @@ TEST_CASE("Parser")
...
@@ -1778,7 +1778,10 @@ TEST_CASE("Parser")
auto
j3
=
"{
\"
key
\"
:
\"
value
\"
}"
_json
;
auto
j3
=
"{
\"
key
\"
:
\"
value
\"
}"
_json
;
CHECK
(
j3
[
"key"
]
==
"value"
);
CHECK
(
j3
[
"key"
]
==
"value"
);
auto
j22
=
R"({"pi": 3.141, "happy": true })"
_json
;
auto
j22
=
R"({
"pi": 3.141,
"happy": true
})"
_json
;
auto
j23
=
"{
\"
pi
\"
: 3.141,
\"
happy
\"
: true }"
_json
;
auto
j23
=
"{
\"
pi
\"
: 3.141,
\"
happy
\"
: true }"
_json
;
CHECK
(
j22
==
j23
);
CHECK
(
j22
==
j23
);
}
}
...
...
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