diff --git a/.gitignore b/.gitignore
index d5bd2f7c9..fd41a2e3c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,3 +12,5 @@ me.nlohmann.json.docset
android
doc/xml
+
+benchmarks/files/numbers/*.json
diff --git a/.travis.yml b/.travis.yml
index b459f5d5a..ffe05ec6c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -168,3 +168,9 @@ script:
- if [ `which valgrind` ]; then
valgrind --error-exitcode=1 --leak-check=full ./json_unit ;
fi
+ - if [ `which brew` ]; then
+ brew update ;
+ brew tap nlohmann/json ;
+ brew install nlohmann_json --HEAD ;
+ brew test nlohmann_json ;
+ fi
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c0488b3b3..72802b29b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.0)
# define the project
-project(nlohmann_json VERSION 2.0.0 LANGUAGES CXX)
+project(nlohmann_json VERSION 2.0.2 LANGUAGES CXX)
enable_testing()
diff --git a/ChangeLog.md b/ChangeLog.md
index e3a7cc07f..8062f3b31 100644
--- a/ChangeLog.md
+++ b/ChangeLog.md
@@ -1,9 +1,11 @@
# Change Log
All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/).
-## [Unreleased](https://github.com/nlohmann/json/tree/HEAD)
+## [v2.0.2](https://github.com/nlohmann/json/releases/tag/v2.0.2) (2016-07-30)
+[Full Changelog](https://github.com/nlohmann/json/compare/v2.0.1...v2.0.2)
-[Full Changelog](https://github.com/nlohmann/json/compare/v2.0.1...HEAD)
+- value\(\) does not work with \_json\_pointer types [\#283](https://github.com/nlohmann/json/issues/283)
+- Easy serialization of classes [\#280](https://github.com/nlohmann/json/issues/280)
- Build error for std::int64 [\#282](https://github.com/nlohmann/json/issues/282)
diff --git a/Makefile b/Makefile
index 56e46d145..15d00f6e5 100644
--- a/Makefile
+++ b/Makefile
@@ -10,6 +10,7 @@ all: json_unit
# clean up
clean:
rm -fr json_unit json_benchmarks fuzz fuzz-testing *.dSYM
+ rm -fr benchmarks/files/numbers/*.json
$(MAKE) clean -Cdoc
@@ -85,6 +86,7 @@ pretty:
# benchmarks
json_benchmarks: benchmarks/benchmarks.cpp benchmarks/benchpress.hpp benchmarks/cxxopts.hpp src/json.hpp
+ cd benchmarks/files/numbers ; python generate.py
$(CXX) -std=c++11 $(CXXFLAGS) -O3 -flto -I src -I benchmarks $< $(LDFLAGS) -o $@
./json_benchmarks
@@ -93,7 +95,9 @@ json_benchmarks: benchmarks/benchmarks.cpp benchmarks/benchpress.hpp benchmarks/
# changelog
##########################################################################
+NEXT_VERSION ?= "unreleased"
+
ChangeLog.md:
- github_changelog_generator -o ChangeLog.md --simple-list --release-url https://github.com/nlohmann/json/releases/tag/%s
+ github_changelog_generator -o ChangeLog.md --simple-list --release-url https://github.com/nlohmann/json/releases/tag/%s --future-release $(NEXT_VERSION)
gsed -i 's|https://github.com/nlohmann/json/releases/tag/HEAD|https://github.com/nlohmann/json/tree/HEAD|' ChangeLog.md
gsed -i '2i All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/).' ChangeLog.md
diff --git a/README.md b/README.md
index 24f6d7ab9..c0bb61b17 100644
--- a/README.md
+++ b/README.md
@@ -4,7 +4,7 @@
[![Build Status](https://ci.appveyor.com/api/projects/status/1acb366xfyg3qybk?svg=true)](https://ci.appveyor.com/project/nlohmann/json)
[![Coverage Status](https://img.shields.io/coveralls/nlohmann/json.svg)](https://coveralls.io/r/nlohmann/json)
[![Coverity Scan Build Status](https://scan.coverity.com/projects/5550/badge.svg)](https://scan.coverity.com/projects/nlohmann-json)
-[![Try online](https://img.shields.io/badge/try-online-blue.svg)](http://melpon.org/wandbox/permlink/wuiuqYiYqRTdI3rG)
+[![Try online](https://img.shields.io/badge/try-online-blue.svg)](http://melpon.org/wandbox/permlink/p5o4znPnGHJpDVqN)
[![Documentation](https://img.shields.io/badge/docs-doxygen-blue.svg)](http://nlohmann.github.io/json)
[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/nlohmann/json/master/LICENSE.MIT)
[![Github Releases](https://img.shields.io/github/release/nlohmann/json.svg)](https://github.com/nlohmann/json/releases)
@@ -24,7 +24,7 @@ Other aspects were not so important to us:
- **Memory efficiency**. Each JSON object has an overhead of one pointer (the maximal size of a union) and one enumeration element (1 byte). The default generalization uses the following C++ data types: `std::string` for strings, `int64_t`, `uint64_t` or `double` for numbers, `std::map` for objects, `std::vector` for arrays, and `bool` for Booleans. However, you can template the generalized class `basic_json` to your needs.
-- **Speed**. We currently implement the parser as naive [recursive descent parser](http://en.wikipedia.org/wiki/Recursive_descent_parser) with hand coded string handling. It is fast enough, but a [LALR-parser](http://en.wikipedia.org/wiki/LALR_parser) with a decent regular expression processor should be even faster (but would consist of more files which makes the integration harder).
+- **Speed**. We currently implement the parser as naive [recursive descent parser](http://en.wikipedia.org/wiki/Recursive_descent_parser) with hand coded string handling. It is fast enough, but a [LALR-parser](http://en.wikipedia.org/wiki/LALR_parser) may be even faster (but would consist of more files which makes the integration harder).
See the [contribution guidelines](https://github.com/nlohmann/json/blob/master/.github/CONTRIBUTING.md#please-dont) for more information.
@@ -505,7 +505,7 @@ $ make
$ ./json_unit "*"
===============================================================================
-All tests passed (5568718 assertions in 32 test cases)
+All tests passed (8905012 assertions in 32 test cases)
```
For more information, have a look at the file [.travis.yml](https://github.com/nlohmann/json/blob/master/.travis.yml).
diff --git a/benchmarks/benchmarks.cpp b/benchmarks/benchmarks.cpp
index 1f5eb5e33..ec6b462c8 100644
--- a/benchmarks/benchmarks.cpp
+++ b/benchmarks/benchmarks.cpp
@@ -44,6 +44,36 @@ BENCHMARK("parse twitter.json", [](benchpress::context* ctx)
}
})
+BENCHMARK("parse numbers/floats.json", [](benchpress::context* ctx)
+{
+ for (size_t i = 0; i < ctx->num_iterations(); ++i)
+ {
+ std::ifstream input_file("benchmarks/files/numbers/floats.json");
+ nlohmann::json j;
+ j << input_file;
+ }
+})
+
+BENCHMARK("parse numbers/signed_ints.json", [](benchpress::context* ctx)
+{
+ for (size_t i = 0; i < ctx->num_iterations(); ++i)
+ {
+ std::ifstream input_file("benchmarks/files/numbers/signed_ints.json");
+ nlohmann::json j;
+ j << input_file;
+ }
+})
+
+BENCHMARK("parse numbers/unsigned_ints.json", [](benchpress::context* ctx)
+{
+ for (size_t i = 0; i < ctx->num_iterations(); ++i)
+ {
+ std::ifstream input_file("benchmarks/files/numbers/unsigned_ints.json");
+ nlohmann::json j;
+ j << input_file;
+ }
+})
+
BENCHMARK("dump jeopardy.json", [](benchpress::context* ctx)
{
std::ifstream input_file("benchmarks/files/jeopardy/jeopardy.json");
diff --git a/benchmarks/files/numbers/generate.py b/benchmarks/files/numbers/generate.py
new file mode 100755
index 000000000..714ee3a1b
--- /dev/null
+++ b/benchmarks/files/numbers/generate.py
@@ -0,0 +1,25 @@
+#!/usr/bin/env python
+
+import json
+import random
+import sys
+
+random.seed(0)
+
+# floats
+result_floats = []
+for x in range(0, 1000000):
+ result_floats.append(random.uniform(-100000000.0, 100000000.0))
+json.dump(result_floats, open("floats.json", "w"), indent=2)
+
+# unsigned integers
+result_uints = []
+for x in range(0, 1000000):
+ result_uints.append(random.randint(0, 18446744073709551615))
+json.dump(result_uints, open("unsigned_ints.json", "w"), indent=2)
+
+# signed integers
+result_sints = []
+for x in range(0, 1000000):
+ result_sints.append(random.randint(-9223372036854775808, 9223372036854775807))
+json.dump(result_sints, open("signed_ints.json", "w"), indent=2)
diff --git a/doc/Doxyfile b/doc/Doxyfile
index e74a8a850..e0055d651 100644
--- a/doc/Doxyfile
+++ b/doc/Doxyfile
@@ -5,7 +5,7 @@
#---------------------------------------------------------------------------
DOXYFILE_ENCODING = UTF-8
PROJECT_NAME = "JSON for Modern C++"
-PROJECT_NUMBER = 2.0.0
+PROJECT_NUMBER = 2.0.2
PROJECT_BRIEF =
PROJECT_LOGO =
OUTPUT_DIRECTORY = .
diff --git a/doc/examples/README.link b/doc/examples/README.link
index ed559e19f..0e87a79e6 100644
--- a/doc/examples/README.link
+++ b/doc/examples/README.link
@@ -1 +1 @@
-online
\ No newline at end of file
+online
\ No newline at end of file
diff --git a/doc/examples/basic_json__value_ptr.cpp b/doc/examples/basic_json__value_ptr.cpp
new file mode 100644
index 000000000..f45fb8b0f
--- /dev/null
+++ b/doc/examples/basic_json__value_ptr.cpp
@@ -0,0 +1,29 @@
+#include
+
+using json = nlohmann::json;
+
+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"_json_pointer, 0);
+ double v_floating = j.value("/floating"_json_pointer, 47.11);
+
+ // access nonexisting values and rely on default value
+ std::string v_string = j.value("/nonexisting"_json_pointer, "oops");
+ bool v_boolean = j.value("/nonexisting"_json_pointer, false);
+
+ // output values
+ std::cout << std::boolalpha << v_integer << " " << v_floating
+ << " " << v_string << " " << v_boolean << "\n";
+}
diff --git a/doc/examples/basic_json__value_ptr.link b/doc/examples/basic_json__value_ptr.link
new file mode 100644
index 000000000..2f8fc83ca
--- /dev/null
+++ b/doc/examples/basic_json__value_ptr.link
@@ -0,0 +1 @@
+online
\ No newline at end of file
diff --git a/doc/examples/basic_json__value_ptr.output b/doc/examples/basic_json__value_ptr.output
new file mode 100644
index 000000000..dfc40e58c
--- /dev/null
+++ b/doc/examples/basic_json__value_ptr.output
@@ -0,0 +1 @@
+1 42.23 oops false
diff --git a/doc/images/callback_events.png b/doc/images/callback_events.png
new file mode 100644
index 000000000..09aa2b383
Binary files /dev/null and b/doc/images/callback_events.png differ
diff --git a/doc/index.md b/doc/index.md
index 5373d4f34..cf32a7a55 100644
--- a/doc/index.md
+++ b/doc/index.md
@@ -268,4 +268,4 @@ The container functions known from STL have been extended to support the differe
@author [Niels Lohmann](http://nlohmann.me)
@see https://github.com/nlohmann/json to download the source code
-@version 2.0.0
+@version 2.0.2
diff --git a/doc/json.gif b/doc/json.gif
index 7edafe018..46f005dd0 100644
Binary files a/doc/json.gif and b/doc/json.gif differ
diff --git a/src/json.hpp b/src/json.hpp
index 291553271..878fb899f 100644
--- a/src/json.hpp
+++ b/src/json.hpp
@@ -1,7 +1,7 @@
/*
__ _____ _____ _____
__| | __| | | | JSON for Modern C++
-| | |__ | | | | | | version 2.0.1
+| | |__ | | | | | | version 2.0.2
|_____|_____|_____|_|___| https://github.com/nlohmann/json
Licensed under the MIT License .
@@ -32,7 +32,6 @@ SOFTWARE.
#include
#include
#include
-#include
#include
#include
#include
@@ -44,6 +43,7 @@ SOFTWARE.
#include
#include
#include
+#include
#include