Lines Matching refs:to_json
713 void to_json(json& j, const person& p) {
725 That's all! When calling the `json` constructor with your type, your custom `to_json` method will b…
738 If you just want to serialize/deserialize some structs, the `to_json`/`from_json` functions can be …
749 The `to_json`/`from_json` functions for the `person` struct above can be created with:
785 static void to_json(json& j, const T& value) {
786 // calls the "to_json" method in T's namespace
804 static void to_json(json& j, const boost::optional<T>& opt) {
808 j = *opt; // this will call adl_serializer<T>::to_json which will
809 // find the free function to_json in T's namespace!
848 // Here's the catch! You must provide a to_json method! Otherwise you
851 static void to_json(json& j, move_only_type t) {
865 - use your `basic_json` alias (or a template parameter) in all your `to_json`/`from_json` methods
866 - use `nlohmann::to_json` and `nlohmann::from_json` when you need ADL
876 static void to_json(BasicJsonType& j, T value) {
877 // we want to use ADL, and call the correct to_json overload
878 using nlohmann::to_json; // this method is called by adl_serializer,
880 to_json(j, value);
899 static void to_json(BasicJsonType& j, const T& value) {
900 // this calls BasicJsonType::json_serializer<T>::to_json(j, value);
906 static void to_json(const BasicJsonType& j, T& value) {
938 The `NLOHMANN_JSON_SERIALIZE_ENUM()` macro declares a set of `to_json()` / `from_json()` functions …