Sha256: 0d4e6d562f0a29297d14b2dc4401b0c9f46fc2885c9f43535d20c0b1a6b92a90

Contents?: true

Size: 546 Bytes

Versions: 1

Compression:

Stored size: 546 Bytes

Contents

#include <iostream>
#include <nlohmann/json.hpp>

using json = nlohmann::json;

int main()
{
    // create JSON values
    json j_object = {{"one", 1}, {"two", 2}};
    json j_array = {1, 2, 4, 8, 16};

    // example for an object
    for (auto& x : json::iterator_wrapper(j_object))
    {
        std::cout << "key: " << x.key() << ", value: " << x.value() << '\n';
    }

    // example for an array
    for (auto& x : json::iterator_wrapper(j_array))
    {
        std::cout << "key: " << x.key() << ", value: " << x.value() << '\n';
    }
}

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
simdjson-0.3.0 vendor/simdjson/dependencies/json/doc/examples/iterator_wrapper.cpp