nlohmann::basic_json::basic_json

create a container (array or object) from an initializer list

Synopsis

Declared in <nlohmann/json.hpp>

basic_json(
    initializer_list_t init,
    bool type_deduction = true,
    value_t manual_type = value_t::array);

Parameters

NameDescription
initinitializer list with JSON values
type_deductionwhether to automatically deduce whether to create an array or an object from the initializer list init
manual_typethe type to create when type_deduction is false