|
OXY API 1.0
OXY API Library Documentation
|
Functor to set a value in a JSON object. More...
#include <json_helper.hpp>
Public Member Functions | |
| template<class T> | |
| json::value & | operator() (json::value &jv, json::string_view key, T const &item) const |
Functor to set a value in a JSON object.
This functor provides an operator() that takes a JSON value, a key, and an item of a generic type T. It checks if the JSON value is an object, and if not, it emplaces an empty object. It then inserts or assigns the key-value pair in the JSON object, where the value is obtained by converting the item to a JSON value using json::value_from. The functor returns a reference to the modified JSON value, allowing for chaining of operations.
|
inline |
| T | - The type of the item to be set in the JSON object. |
| jv | - The JSON value to modify. |
| key | - The key to set in the JSON object. |
| item | - The item to set in the JSON object. |