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
48545f5b
Commit
48545f5b
authored
Jun 22, 2015
by
Niels
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more documentation
parent
f1c9aa26
Changes
14
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
486 additions
and
78 deletions
+486
-78
doc/examples/basic_json__CompatibleNumberFloatType.cpp
doc/examples/basic_json__CompatibleNumberFloatType.cpp
+21
-0
doc/examples/basic_json__CompatibleNumberFloatType.output
doc/examples/basic_json__CompatibleNumberFloatType.output
+3
-0
doc/examples/basic_json__CompatibleStringType.cpp
doc/examples/basic_json__CompatibleStringType.cpp
+15
-0
doc/examples/basic_json__CompatibleStringType.output
doc/examples/basic_json__CompatibleStringType.output
+1
-0
doc/examples/basic_json__InputIt_InputIt.cpp
doc/examples/basic_json__InputIt_InputIt.cpp
+21
-0
doc/examples/basic_json__InputIt_InputIt.output
doc/examples/basic_json__InputIt_InputIt.output
+3
-0
doc/examples/basic_json__boolean_t.cpp
doc/examples/basic_json__boolean_t.cpp
+14
-0
doc/examples/basic_json__boolean_t.output
doc/examples/basic_json__boolean_t.output
+2
-0
doc/examples/basic_json__const_int.cpp
doc/examples/basic_json__const_int.cpp
+15
-0
doc/examples/basic_json__const_int.output
doc/examples/basic_json__const_int.output
+1
-0
doc/examples/operator_deserialize.cpp
doc/examples/operator_deserialize.cpp
+23
-0
doc/examples/operator_deserialize.output
doc/examples/operator_deserialize.output
+13
-0
src/json.hpp
src/json.hpp
+177
-39
src/json.hpp.re2c
src/json.hpp.re2c
+177
-39
No files found.
doc/examples/basic_json__CompatibleNumberFloatType.cpp
0 → 100644
View file @
48545f5b
#include <json.hpp>
using
namespace
nlohmann
;
int
main
()
{
// create values of different floating-point types
float
f42
=
42.23
;
float
f_nan
=
1.0
f
/
0.0
f
;
double
f23
=
23.42
;
// create JSON numbers
json
j42
(
f42
);
json
j_nan
(
f_nan
);
json
j23
(
f23
);
// serialize the JSON numbers
std
::
cout
<<
j42
<<
'\n'
;
std
::
cout
<<
j_nan
<<
'\n'
;
std
::
cout
<<
j23
<<
'\n'
;
}
doc/examples/basic_json__CompatibleNumberFloatType.output
0 → 100644
View file @
48545f5b
42.2299995422363
null
23.42
doc/examples/basic_json__CompatibleStringType.cpp
0 → 100644
View file @
48545f5b
#include <json.hpp>
using
namespace
nlohmann
;
int
main
()
{
// create a string value
std
::
string
s
=
"The quick brown fox jumps over the lazy dog."
;
// create a JSON string value
json
j
=
s
;
// serialize the JSON string
std
::
cout
<<
j
<<
'\n'
;
}
doc/examples/basic_json__CompatibleStringType.output
0 → 100644
View file @
48545f5b
"The quick brown fox jumps over the lazy dog."
doc/examples/basic_json__InputIt_InputIt.cpp
0 → 100644
View file @
48545f5b
#include <json.hpp>
using
namespace
nlohmann
;
int
main
()
{
// create JSON values
json
j_array
=
{
"alpha"
,
"bravo"
,
"charly"
,
"delta"
,
"easy"
};
json
j_number
=
42
;
json
j_object
=
{{
"one"
,
"eins"
},
{
"two"
,
"zwei"
}};
// create copies using iterators
json
j_array_range
(
j_array
.
begin
()
+
1
,
j_array
.
end
()
-
2
);
json
j_number_range
(
j_number
.
begin
(),
j_number
.
end
());
json
j_object_range
(
j_object
.
begin
(),
j_object
.
find
(
"two"
));
// serialize the values
std
::
cout
<<
j_array_range
<<
'\n'
;
std
::
cout
<<
j_number_range
<<
'\n'
;
std
::
cout
<<
j_object_range
<<
'\n'
;
}
doc/examples/basic_json__InputIt_InputIt.output
0 → 100644
View file @
48545f5b
["bravo","charly"]
42
{"one":"eins"}
doc/examples/basic_json__boolean_t.cpp
0 → 100644
View file @
48545f5b
#include <json.hpp>
using
namespace
nlohmann
;
int
main
()
{
// create boolean values
json
j_truth
=
true
;
json
j_falsity
=
false
;
// serialize the JSON booleans
std
::
cout
<<
j_truth
<<
'\n'
;
std
::
cout
<<
j_falsity
<<
'\n'
;
}
doc/examples/basic_json__boolean_t.output
0 → 100644
View file @
48545f5b
true
false
doc/examples/basic_json__const_int.cpp
0 → 100644
View file @
48545f5b
#include <json.hpp>
using
namespace
nlohmann
;
int
main
()
{
// an anonymous enum
enum
{
t
=
17
};
// create a JSON number from the enum
json
j
(
t
);
// serialize the JSON numbers
std
::
cout
<<
j
<<
'\n'
;
}
doc/examples/basic_json__const_int.output
0 → 100644
View file @
48545f5b
17
doc/examples/operator_deserialize.cpp
0 → 100644
View file @
48545f5b
#include <json.hpp>
using
namespace
nlohmann
;
int
main
()
{
// create stream with serialized JSON
std
::
stringstream
ss
;
ss
<<
R"({
"number": 23,
"string": "Hello, world!",
"array": [1, 2, 3, 4, 5],
"boolean": false,
"null": null
})"
;
// create JSON value and read the serialization from the stream
json
j
;
j
<<
ss
;
// serialize JSON
std
::
cout
<<
std
::
setw
(
2
)
<<
j
<<
'\n'
;
}
doc/examples/operator_deserialize.output
0 → 100644
View file @
48545f5b
{
"array": [
1,
2,
3,
4,
5
],
"boolean": false,
"null": null,
"number": 23,
"string": "Hello, world!"
}
src/json.hpp
View file @
48545f5b
This diff is collapsed.
Click to expand it.
src/json.hpp.re2c
View file @
48545f5b
This diff is collapsed.
Click to expand it.
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