Merge branch 'master' of https://github.com/nlohmann/json
This commit is contained in:
commit
e1645a09e9
23 changed files with 6245 additions and 2746 deletions
|
@ -1,5 +1,27 @@
|
|||
# JSON for Modern C++
|
||||
|
||||
## Version 1.0.0
|
||||
|
||||
- Release date: 2015-12-28
|
||||
- MD5: 331c30e4407ecdcf591e9e3ed85100d0
|
||||
|
||||
### Summary
|
||||
|
||||
This is the first official release. Compared to the [prerelease version 1.0.0-rc1](https://github.com/nlohmann/json/releases/tag/v1.0.0-rc1), only a few minor improvements have been made:
|
||||
|
||||
### Changes
|
||||
|
||||
- *Changed*: A **UTF-8 byte order mark** is silently ignored.
|
||||
- *Changed*: `sprintf` is no longer used.
|
||||
- *Changed*: `iterator_wrapper` also works for const objects; note: the name may change!
|
||||
- *Changed*: **Error messages** during deserialization have been improved.
|
||||
- *Added*: The `parse` function now also works with type `std::istream&&`.
|
||||
- *Added*: Function `value(key, default_value)` returns either a copy of an object's element at the specified key or a given default value if no element with the key exists.
|
||||
- *Added*: Public functions are tagged with the version they were introduced. This shall allow for better **versioning** in the future.
|
||||
- *Added*: All public functions and types are **documented** (see http://nlohmann.github.io/json/) including executable examples.
|
||||
- *Added*: Allocation of all types (in particular arrays, strings, and objects) is now exception-safe.
|
||||
- *Added*: They descriptions of thrown exceptions have been overworked and are part of the tests suite and documentation.
|
||||
|
||||
## Version 1.0.0-rc1
|
||||
|
||||
- Release date: 2015-07-26
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#---------------------------------------------------------------------------
|
||||
DOXYFILE_ENCODING = UTF-8
|
||||
PROJECT_NAME = "JSON for Modern C++"
|
||||
PROJECT_NUMBER = 1.0.0-rc1
|
||||
PROJECT_NUMBER = 1.0.0
|
||||
PROJECT_BRIEF =
|
||||
PROJECT_LOGO =
|
||||
OUTPUT_DIRECTORY = .
|
||||
|
@ -121,7 +121,7 @@ USE_MDFILE_AS_MAINPAGE =
|
|||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to source browsing
|
||||
#---------------------------------------------------------------------------
|
||||
SOURCE_BROWSER = NO
|
||||
SOURCE_BROWSER = YES
|
||||
INLINE_SOURCES = NO
|
||||
STRIP_CODE_COMMENTS = YES
|
||||
REFERENCED_BY_RELATION = NO
|
||||
|
|
|
@ -26,8 +26,8 @@ int main()
|
|||
{
|
||||
object.at("the fast") = "il rapido";
|
||||
}
|
||||
catch (std::out_of_range)
|
||||
catch (std::out_of_range& e)
|
||||
{
|
||||
std::cout << "out of range" << '\n';
|
||||
std::cout << "out of range: " << e.what() << '\n';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
<a target="_blank" href="http://melpon.org/wandbox/permlink/syN4hQrhPvlUy5AG"><b>online</b></a>
|
||||
<a target="_blank" href="http://melpon.org/wandbox/permlink/3ir8W1OZ5KtbRz6r"><b>online</b></a>
|
|
@ -1,3 +1,3 @@
|
|||
"il brutto"
|
||||
{"the bad":"il cattivo","the good":"il buono","the ugly":"il brutto"}
|
||||
out of range
|
||||
out of range: key 'the fast' not found
|
||||
|
|
|
@ -21,8 +21,8 @@ int main()
|
|||
{
|
||||
array.at(5) = "sixth";
|
||||
}
|
||||
catch (std::out_of_range)
|
||||
catch (std::out_of_range& e)
|
||||
{
|
||||
std::cout << "out of range" << '\n';
|
||||
std::cout << "out of range: " << e.what() << '\n';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
<a target="_blank" href="http://melpon.org/wandbox/permlink/wKBBW3ORmTHPlgJV"><b>online</b></a>
|
||||
<a target="_blank" href="http://melpon.org/wandbox/permlink/9Ae4DO4HJjULnq5j"><b>online</b></a>
|
|
@ -1,3 +1,3 @@
|
|||
"third"
|
||||
["first","second","third","fourth"]
|
||||
out of range
|
||||
out of range: array index 5 is out of range
|
||||
|
|
29
doc/examples/basic_json__value.cpp
Normal file
29
doc/examples/basic_json__value.cpp
Normal file
|
@ -0,0 +1,29 @@
|
|||
#include <json.hpp>
|
||||
|
||||
using namespace nlohmann;
|
||||
|
||||
int main()
|
||||
{
|
||||
// create a JSON object with different entry types
|
||||
json j =
|
||||
{
|
||||
{"integer", 1},
|
||||
{"floating", 42.23},
|
||||
{"string", "hello world"},
|
||||
{"boolean", true},
|
||||
{"object", {{"key1", 1}, {"key2", 2}}},
|
||||
{"array", {1, 2, 3}}
|
||||
};
|
||||
|
||||
// access existing values
|
||||
int v_integer = j.value("integer", 0);
|
||||
double v_floating = j.value("floating", 47.11);
|
||||
|
||||
// access nonexisting values and rely on default value
|
||||
std::string v_string = j.value("nonexisting", "oops");
|
||||
bool v_boolean = j.value("nonexisting", false);
|
||||
|
||||
// output values
|
||||
std::cout << std::boolalpha << v_integer << " " << v_floating
|
||||
<< " " << v_string << " " << v_boolean << "\n";
|
||||
}
|
1
doc/examples/basic_json__value.link
Normal file
1
doc/examples/basic_json__value.link
Normal file
|
@ -0,0 +1 @@
|
|||
<a target="_blank" href="http://melpon.org/wandbox/permlink/pehnjdIduvv90qfX"><b>online</b></a>
|
1
doc/examples/basic_json__value.output
Normal file
1
doc/examples/basic_json__value.output
Normal file
|
@ -0,0 +1 @@
|
|||
1 42.23 oops false
|
|
@ -5,7 +5,7 @@ using namespace nlohmann;
|
|||
int main()
|
||||
{
|
||||
// create a JSON object
|
||||
json object =
|
||||
const json object =
|
||||
{
|
||||
{"one", 1}, {"two", 2}, {"three", 2.9}
|
||||
};
|
||||
|
|
|
@ -1 +1 @@
|
|||
<a target="_blank" href="http://melpon.org/wandbox/permlink/9X5Q8p7DlWA6v0Ey"><b>online</b></a>
|
||||
<a target="_blank" href="http://melpon.org/wandbox/permlink/4WLxv7id8P64Q1KI"><b>online</b></a>
|
Loading…
Add table
Add a link
Reference in a new issue