22 #include "google/protobuf/message.h" 23 #include "nlohmann/json.hpp" 38 const std::string &json_type,
const google::protobuf::Message &proto);
44 static bool GetString(
const nlohmann::json &json,
const std::string &key,
52 static bool GetNumber(
const nlohmann::json &json,
const std::string &key,
54 const auto iter = json.find(key);
55 if (iter == json.end()) {
56 AERROR <<
"The json has no such key: " << key;
59 if (!iter->is_number()) {
60 AERROR <<
"The value of json[" << key <<
"] is not a number";
71 static bool GetBoolean(
const nlohmann::json &json,
const std::string &key,
79 const std::string &key,
80 std::vector<std::string> *value);
static bool GetNumber(const nlohmann::json &json, const std::string &key, T *value)
Get a number value from the given json[key].
Definition: json_util.h:52
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
static nlohmann::json ProtoToTypedJson(const std::string &json_type, const google::protobuf::Message &proto)
Convert proto to a json string.
static bool GetString(const nlohmann::json &json, const std::string &key, std::string *value)
Get a string value from the given json[key].
Definition: json_util.h:31
static bool GetBoolean(const nlohmann::json &json, const std::string &key, bool *value)
Get a boolean value from the given json[key].
apollo::cyber::base::std value
#define AERROR
Definition: log.h:44
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].