JSON for Modern C++  2.0.0
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 NumberUnsignedType = uint64_t, class NumberFloatType = double, template< typename U > class AllocatorType = std::allocator>
nlohmann::basic_json::basic_json ( boolean_t  val)
inlinenoexcept

Creates a JSON boolean type from a given value.

Parameters
[in]vala boolean value to store
Complexity
Constant.
Example
The example below demonstrates boolean values.
1 #include <json.hpp>
2 
3 using json = nlohmann::json;
4 
5 int main()
6 {
7  // create boolean values
8  json j_truth = true;
9  json j_falsity = false;
10 
11  // serialize the JSON booleans
12  std::cout << j_truth << '\n';
13  std::cout << j_falsity << '\n';
14 }
basic_json<> json
default JSON class
Definition: json.hpp:8653
Output (play with this example online):
true
false
The example code above can be translated with
g++ -std=c++11 -Isrc doc/examples/basic_json__boolean_t.cpp -o basic_json__boolean_t 
Since
version 1.0.0

Definition at line 1211 of file json.hpp.