File tree 5 files changed +29
-3
lines changed
5 files changed +29
-3
lines changed Original file line number Diff line number Diff line change 1
- {
2
- "nlohmann/json" : { "@" : "v3.11.1", "x" : ["benchmarks"] }
3
- , "platform" : [ "Boost::+boost" ]
1
+ {
2
+ "nlohmann/json" : { "@" : "v3.11.2", "x" : ["benchmarks"] }
3
+ , "tipi-deps/boost" : {
4
+ "@" : "v1.80.0-without-submodules"
5
+ , "u" : true
6
+ , "packages" : ["boost_fusion"]
7
+ , "targets" : ["Boost::fusion"]
8
+ }
4
9
}
Original file line number Diff line number Diff line change
1
+ {"host_name":"github.com","org_name":"cpp-pre","repo_name":"json"}
Original file line number Diff line number Diff line change
1
+ set(BOOST_INCLUDE_LIBRARIES fusion)
Original file line number Diff line number Diff line change @@ -111,6 +111,7 @@ namespace pre { namespace json { namespace detail {
111
111
template <class T ,
112
112
enable_if_is_associative_container_t <T>* = nullptr >
113
113
void operator ()(const T& value) const {
114
+ _json_object = nlohmann::json::object ();
114
115
for (const auto & each : value) {
115
116
nlohmann::json json_subobject;
116
117
jsonizer subjsonizer (json_subobject);
Original file line number Diff line number Diff line change @@ -400,6 +400,24 @@ BOOST_AUTO_TEST_CASE(maps) {
400
400
BOOST_REQUIRE (some_deserialized == some);
401
401
}
402
402
403
+ BOOST_AUTO_TEST_CASE (empty_map) {
404
+
405
+ std::map<std::string, std::string> some{};
406
+
407
+ auto some_json = pre::json::to_json (some);
408
+ std::cout << some_json.dump (2 ) << std::endl;
409
+
410
+ auto some_deserialized = pre::json::from_json<decltype (some)>(some_json);
411
+
412
+ BOOST_REQUIRE (some_deserialized == some);
413
+
414
+ auto empty_map = pre::json::to_json ( std::map<std::string, std::string> {} ).dump ();
415
+ BOOST_REQUIRE (empty_map != " null" );
416
+ BOOST_REQUIRE (empty_map == " {}" );
417
+ }
418
+
419
+
420
+
403
421
404
422
namespace datamodel {
405
423
You can’t perform that action at this time.
0 commit comments