1
0
mirror of https://github.com/nlohmann/json synced 2024-11-22 12:00:05 +00:00
nlohmannjson/docs/examples/operator__equal__specializations.cpp
Niels Lohmann 2d48a4d9c5
Add documentation for comparing json and ordered_json (#3599)
* 📝 add documentation for #3443

* Apply suggestions from code review

Co-authored-by: Florian Albrechtskirchinger <falbrechtskirchinger@gmail.com>
2022-07-23 20:54:40 +02:00

17 lines
474 B
C++

#include <iostream>
#include <iomanip>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
int main()
{
nlohmann::json uj1 = {{"version", 1}, {"type", "integer"}};
nlohmann::json uj2 = {{"type", "integer"}, {"version", 1}};
nlohmann::ordered_json oj1 = {{"version", 1}, {"type", "integer"}};
nlohmann::ordered_json oj2 = {{"type", "integer"}, {"version", 1}};
std::cout << std::boolalpha << (uj1 == uj2) << '\n' << (oj1 == oj2) << std::endl;
}