allocator_type
array
array_t
at
at
at
at
back
back
basic_json
basic_json
basic_json
basic_json
basic_json
basic_json
basic_json
basic_json
basic_json
basic_json
basic_json
basic_json
basic_json
basic_json
basic_json
basic_json
basic_json
basic_json
basic_json
basic_json
basic_json
begin
begin
boolean_t
cbegin
cend
clear
const_pointer
const_reference
count
crbegin
crend
difference_type
dump
empty
end
end
erase
erase
erase
erase
find
find
front
front
get
get
get
get_allocator
get_ptr
get_ptr
is_array
is_boolean
is_discarded
is_null
is_number
is_number_float
is_number_integer
is_object
is_primitive
is_string
is_structured
max_size
number_float_t
number_integer_t
object
object_t
operator value_t
operator ValueType
operator!=
operator+=
operator+=
operator+=
operator<
operator<
operator<<
operator<<
operator<=
operator=
operator==
operator>
operator>=
operator>>
operator>>
operator[]
operator[]
operator[]
operator[]
operator[]
operator[]
parse
parse
parse_event_t
parser_callback_t
pointer
push_back
push_back
push_back
rbegin
rbegin
reference
rend
rend
size
size_type
string_t
swap
swap
swap
swap
type
value_t
value_type
~basic_json

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 AllocatorType = std::allocator>

nlohmann::basic_json::operator value_t | ( |  | ) | const

inlinenoexcept

Implicitly return the type of the JSON value as a value from the value_t enumeration.

Returns
  the type of the JSON value

Complexity
  Constant.

Example
  The following code exemplifies the value_t operator for all JSON types.
  #include <json.hpp>
  using namespace nlohmann;
  int main()
  {
  // create JSON values
  json j_null;
  json j_boolean = true;
  json j_number_integer = 17;
  json j_number_float = 23.42;
  json j_object = {{"one", 1}, {"two", 2}};
  json j_array = {1, 2, 4, 8, 16};
  json j_string = "Hello, world";
  // call operator value_t()
  json::value_t t_null = j_null;
  json::value_t t_boolean = j_boolean;
  json::value_t t_number_integer = j_number_integer;
  json::value_t t_number_float = j_number_float;
  json::value_t t_object = j_object;
  json::value_t t_array = j_array;
  json::value_t t_string = j_string;
  // print types
  std::cout << std::boolalpha;
  std::cout << (t_null == json::value_t::null) << '\n';
  std::cout << (t_boolean == json::value_t::boolean) << '\n';
  std::cout << (t_number_integer == json::value_t::number_integer) << '\n';
  std::cout << (t_number_float == json::value_t::number_float) << '\n';
  std::cout << (t_object == json::value_t::object) << '\n';
  std::cout << (t_array == json::value_t::array) << '\n';
  std::cout << (t_string == json::value_t::string) << '\n';
  }
  nlohmann::basic_json
  a class to store JSON values
  Definition: json.hpp:130
  nlohmann::basic_json::value_t::object
  object (unordered set of name/value pairs)
  nlohmann
  namespace for Niels Lohmann
  Definition: json.hpp:55
  nlohmann::basic_json::value_t::string
  string value
  nlohmann::basic_json::value_t
  value_t
  the JSON type enumeration
  Definition: json.hpp:511
  nlohmann::basic_json::value_t::array
  array (ordered collection of values)
  nlohmann::basic_json::value_t::null
  null value
  nlohmann::basic_json::value_t::number_float
  number value (floating-point)
  nlohmann::basic_json::value_t::boolean
  boolean value
  nlohmann::basic_json::value_t::number_integer
  number value (integer)
  Output (play with this example online):

      true
      true
      true
      true
      true
      true
      true

  The example code above can be translated with

      g++ -std=c++11 -Isrc doc/examples/operator__value_t.cpp -o operator__value_t