#include <json_util.h>
|
static nlohmann::json | ProtoToTypedJson (const std::string &json_type, const google::protobuf::Message &proto) |
| Convert proto to a json string. More...
|
|
static bool | GetString (const nlohmann::json &json, const std::string &key, std::string *value) |
| Get a string value from the given json[key]. More...
|
|
template<class T > |
static bool | GetNumber (const nlohmann::json &json, const std::string &key, T *value) |
| Get a number value from the given json[key]. More...
|
|
static bool | GetBoolean (const nlohmann::json &json, const std::string &key, bool *value) |
| Get a boolean value from the given json[key]. More...
|
|
static bool | GetStringVector (const nlohmann::json &json, const std::string &key, std::vector< std::string > *value) |
| Get a string vector from the given json[key]. More...
|
|
◆ GetBoolean()
static bool apollo::common::util::JsonUtil::GetBoolean |
( |
const nlohmann::json & |
json, |
|
|
const std::string & |
key, |
|
|
bool * |
value |
|
) |
| |
|
static |
Get a boolean value from the given json[key].
- Returns
- Whether the field exists and is a valid boolean.
◆ GetNumber()
template<class T >
static bool apollo::common::util::JsonUtil::GetNumber |
( |
const nlohmann::json & |
json, |
|
|
const std::string & |
key, |
|
|
T * |
value |
|
) |
| |
|
inlinestatic |
Get a number value from the given json[key].
- Returns
- Whether the field exists and is a valid number.
◆ GetString()
static bool apollo::common::util::JsonUtil::GetString |
( |
const nlohmann::json & |
json, |
|
|
const std::string & |
key, |
|
|
std::string * |
value |
|
) |
| |
|
static |
Get a string value from the given json[key].
- Returns
- Whether the field exists and is a valid string.
◆ GetStringVector()
static bool apollo::common::util::JsonUtil::GetStringVector |
( |
const nlohmann::json & |
json, |
|
|
const std::string & |
key, |
|
|
std::vector< std::string > * |
value |
|
) |
| |
|
static |
Get a string vector from the given json[key].
- Returns
- Whether the field exists and is a valid string vector.
◆ ProtoToTypedJson()
static nlohmann::json apollo::common::util::JsonUtil::ProtoToTypedJson |
( |
const std::string & |
json_type, |
|
|
const google::protobuf::Message & |
proto |
|
) |
| |
|
static |
Convert proto to a json string.
- Returns
- A json with two fields: {type:<json_type>, data:<proto_to_json>}.
The documentation for this class was generated from the following file: