nlohmann::json is a popluar json lib.
code at: https://github.com/nlohmann/json
document at: https://nlohmann.github.io/json/doxygen/index.html
sample code:
There are several ways to for value access :
value access
- get – get a value
- get_ptr – get a value pointer
- get_ref – get a value reference
- get_binary – get a binary value
- operator ValueType – get a value (implicit conversion)
- value – get a value from an object and return default value if key is not present
in addtion, there are: jsonobj.at(“key”), jsonobj[“key”] etc . quite confusing if you r newbie,
Here is the document:
.value():
Unlike at(const typename object_t::key_type&), this function does not throw if the given key key was not found.
Unlike operator[](const typename object_t::key_type& key), this function does not implicitly add an element to the position defined by key. This function is furthermore also applicable to const objects.