Go to the documentation of this file.00001 #include <json.hpp>
00002 #include <unordered_map>
00003
00004 using json = nlohmann::json;
00005
00006 int main()
00007 {
00008
00009 std::map<std::string, int> c_map
00010 {
00011 {"one", 1}, {"two", 2}, {"three", 3}
00012 };
00013 json j_map(c_map);
00014
00015
00016 std::unordered_map<const char*, double> c_umap
00017 {
00018 {"one", 1.2}, {"two", 2.3}, {"three", 3.4}
00019 };
00020 json j_umap(c_umap);
00021
00022
00023 std::multimap<std::string, bool> c_mmap
00024 {
00025 {"one", true}, {"two", true}, {"three", false}, {"three", true}
00026 };
00027 json j_mmap(c_mmap);
00028
00029
00030 std::unordered_multimap<std::string, bool> c_ummap
00031 {
00032 {"one", true}, {"two", true}, {"three", false}, {"three", true}
00033 };
00034 json j_ummap(c_ummap);
00035
00036
00037 std::cout << j_map << '\n';
00038 std::cout << j_umap << '\n';
00039 std::cout << j_mmap << '\n';
00040 std::cout << j_ummap << '\n';
00041 }