#include <json_mapper.hpp>
Public Member Functions | |
json_mapper ()=default | |
std::string | to_string (const json &js, const json_format &format=json_format::compact) |
template<class T > | |
std::string | to_string (const T &obj, const json_format &format=json_format::compact) |
template<class T > | |
std::string | to_string (const std::vector< T > &array, const json_format &format=json_format::compact) |
template<class T > | |
json | to_json (const T &obj) |
json | to_json (const std::string &str) |
json | to_json (const char *str) |
template<class T > | |
T | to_object (const json &js) |
template<class T > | |
std::vector< T > | to_objects (const json &js) |
template<class T > | |
T | to_object (const std::string &str) |
template<class T > | |
T | to_object (const char *str) |
template<class T > | |
std::vector< T > | to_objects (const std::string &str) |
template<class T > | |
std::vector< T > | to_objects (const char *str) |
conversions string <-> json <-> object
string to_string(json) string to_string(object) string to_string(array<object>)
json to_json(object) json to_json(array<object>) json to_json(string)
object to_object(json) object to_object(string) array<object> to_objects(json) array<object> to_objects(string)
|
default |
Default constructor
json matador::json_mapper::to_json | ( | const char * | str | ) |
Converts the given json string into a json object.
str | Json string to convert |
json matador::json_mapper::to_json | ( | const std::string & | str | ) |
Converts the given json string into a json object.
str | Json string to convert |
json matador::json_mapper::to_json | ( | const T & | obj | ) |
Converts the given object into a json object.
T | Type of the object to convert |
obj | Object to convert |
T matador::json_mapper::to_object | ( | const char * | str | ) |
Convert a given json string into a concrete object
T | Type of the object to create |
str | Json string to convert |
T matador::json_mapper::to_object | ( | const json & | js | ) |
Converts a given json object into the concrete object.
T | Type of the object to create |
js | Json object to convert |
T matador::json_mapper::to_object | ( | const std::string & | str | ) |
Convert a given json string into a concrete object
T | Type of the object to create |
str | Json string to convert |
std::vector< T > matador::json_mapper::to_objects | ( | const char * | str | ) |
Converts a given json string representing an array into a vector of objects.
T | Type of the objects to create |
str | Json array string to convert |
std::vector< T > matador::json_mapper::to_objects | ( | const json & | js | ) |
Converts a json object of type array into an array concrete objects.
T | Type of the objects to create |
js | Json to convert |
std::vector< T > matador::json_mapper::to_objects | ( | const std::string & | str | ) |
Converts a given json string representing an array into a vector of objects.
T | Type of the objects to create |
str | Json array string to convert |
std::string matador::json_mapper::to_string | ( | const json & | js, |
const json_format & | format = json_format::compact |
||
) |
Converts a given json object into a string where the format is defined by the given json format object.
js | Json object to be converted |
format | Format of the output string |
std::string matador::json_mapper::to_string | ( | const std::vector< T > & | array, |
const json_format & | format = json_format::compact |
||
) |
Converts the given array of objects into a json string where the format is defined by the given json format object.
T | Type of the objects to convert |
array | Array of objects to convert |
format | Format of the output string |
std::string matador::json_mapper::to_string | ( | const T & | obj, |
const json_format & | format = json_format::compact |
||
) |
Converts the given object into a json string where the format is defined by the given json format object.
T | Type of the object to convert |
obj | Object to convert |
format | Format of the output string |