1 #include <sstream>
2 #include <iostream>
3 #include <nlohmann/json.hpp>
4
5 using json = nlohmann::json;
6
main()7 int main()
8 {
9 // JSON Lines (see https://jsonlines.org)
10 std::stringstream input;
11 input << R"({"name": "Gilbert", "wins": [["straight", "7♣"], ["one pair", "10♥"]]}
12 {"name": "Alexa", "wins": [["two pair", "4♠"], ["two pair", "9♠"]]}
13 {"name": "May", "wins": []}
14 {"name": "Deloise", "wins": [["three of a kind", "5♣"]]}
15 )";
16
17 std::string line;
18 while (std::getline(input, line))
19 {
20 std::cout << json::parse(line) << std::endl;
21 }
22 }
23