2.9 KiB
2.9 KiB
nlohmann::basic_json
Defined in header <json.hpp>
template <
template<typename U, typename V, typename... Args> class ObjectType = std::map,
template<typename U, typename... Args> class ArrayType = std::vector,
class StringType = std::string,
class BooleanType = bool,
class NumberIntegerType = int64_t,
class NumberFloatType = double,
template<typename U> class Allocator = std::allocator
> class basic_json;
Template Parameters
ObjectType- The type to store collection of name/value pairs. It can be any associative container that can hold key-value pairs as long as the key type is the same asStringType. The value type is againnlohmann::basic_json. The parameterObjectTypedefaults tostd::map.ArrayType- The type to store ordered value lists. It can be any sequence container. The parameterArrayTypedefaults to astd::vectorwhose elements are of typenlohmann::basic_json.StringType- The type to store string values. The parameterStringTypedefaults tostd::string.BooleanTypeNumberIntegerTypeNumberFloatTypeAllocator- An allocator that is used to acquire memory to store the elements. The type must meet the requirements ofAllocator.
Specializations
A standard JSON type nlohmann::json is defined in <json.hpp> which uses the default types:
using json = basic_json<
std::map,
std::vector,
std::string,
bool,
int64_t,
double,
std::allocator
>
Iterator invalidation
Member types
value_typereferenceconst_referencedifference_typesize_typeallocator_typepointerconst_pointeriteratorconst_iteratorreverse_iteratorconst_reverse_iteratorobject_tarray_tstring_tboolean_tnumber_integer_tnumber_float_tlist_init_tjson_value
Member functions
- constructor
- destructor
operator=get_allocator
Object inspection
dumptypeis_nullis_booleanis_numberis_objectis_arrayis_stringoperator value_tstd::hash
Value conversion
get- implicit conversion
Element access
atoperator[]erasefindcount
Iterators
begin/cbeginend/cendrbegin/crbeginrend/crend
Capacity
emptysizemax_size
Modifiers
clearpush_backoperator+=eraseswapstd::swap
Comparisons
operator==operator!=operator<operator<=operator>operator>=
Serialization
dumpoperator<<operator>>
Deserialization
parseoperator<<operator>>