JSON for Modern C++ 2.1.1
|
These pages contain the API documentation of JSON for Modern C++, a C++11 header-only JSON class.
basic_json
class The container functions known from STL have been extended to support the different value types from JSON. However, not all functions can be applied to all value types. Note that the signature of some functions differ between the types; for instance, at
may be called with either a string to address a key in an object or with an integer to address a value in an array.
group | function | JSON value type | |||||
---|---|---|---|---|---|---|---|
object | array | string | number | boolean | null | ||
iterators | begin | begin | begin | begin | begin | begin | begin (returns end() ) |
cbegin | cbegin | cbegin | cbegin | cbegin | cbegin | cbegin (returns cend() ) | |
end | end | end | end | end | end | end | |
cend | cend | cend | cend | cend | cend | cend | |
rbegin | rbegin | rbegin | rbegin | rbegin | rbegin | rbegin | |
crbegin | crbegin | crbegin | crbegin | crbegin | crbegin | crbegin | |
rend | rend | rend | rend | rend | rend | rend | |
crend | crend | crend | crend | crend | crend | crend | |
element access | at | at | at | throws std::domain_error | throws std::domain_error | throws std::domain_error | throws std::domain_error |
operator[] | operator[] | operator[] | throws std::domain_error | throws std::domain_error | throws std::domain_error | operator[] (creates object)operator[] (creates array) | |
front | front | front | front | front | front | throws std::out_of_range | |
back | back | back | back | back | back | throws std::out_of_range | |
capacity | empty | empty | empty | empty (returns false ) | empty (returns false ) | empty (returns false ) | empty (returns true ) |
size | size | size | size (returns 1 ) | size (returns 1 ) | size (returns 1 ) | size (returns 0 ) | |
max_size_ | max_size | max_size | max_size (returns 1 ) | max_size (returns 1 ) | max_size (returns 1 ) | max_size (returns 0 ) | |
modifiers | clear | clear | clear | clear | clear | clear | clear |
insert | throws std::domain_error | insert | throws std::domain_error | throws std::domain_error | throws std::domain_error | throws std::domain_error | |
erase | erase | erase | erase (converts to null) | erase (converts to null) | erase (converts to null) | throws | |
push_back | push_back | push_back | throws std::domain_error | throws std::domain_error | throws std::domain_error | push_back (creates object)push_back (creates array) | |
emplace / emplace_back | emplace | emplace_back | throws std::domain_error | throws std::domain_error | throws std::domain_error | emplace (creates object)emplace_back (creates array) | |
swap | swap | swap | swap | swap | swap | swap | |
lookup | find | find (returns end() ) | find | find (returns end() ) | find (returns end() ) | find (returns end() ) | find (returns end() ) |
count | count (returns 0 ) | count | count (returns 0 ) | count (returns 0 ) | count (returns 0 ) | count (returns 0 ) |