Sha256: bd8d907dd6898fa70ba9a43bc4451e25f0b457e6c67ec8b110ea049e115b8499

Contents?: true

Size: 444 Bytes

Versions: 1

Compression:

Stored size: 444 Bytes

Contents

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

using json = nlohmann::json;

int main()
{
    // create a JSON value
    json value = {{"array", {1, 2, 3, 4}}};

    // create an array_t
    json::array_t array = {"Snap", "Crackle", "Pop"};

    // swap the array stored in the JSON value
    value["array"].swap(array);

    // output the values
    std::cout << "value = " << value << '\n';
    std::cout << "array = " << array << '\n';
}

Version data entries

1 entries across 1 versions & 1 rubygems

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