bes Updated for version 3.21.1
The Backend Server (BES) is the lower two tiers of the Hyrax data server
cmr::JsonUtils Class Reference
Collaboration diagram for cmr::JsonUtils:
Collaboration graph

Public Member Functions

nlohmann::json get_as_json (const std::string &url) const
 
std::string get_str_if_present (const std::string &key, const nlohmann::json &json_obj) const
 
std::string probe_json (const nlohmann::json &j) const
 
bool qc_boolean (const std::string &key, const nlohmann::json &json_obj) const
 
double qc_double (const std::string &key, const nlohmann::json &json_obj) const
 
const nlohmann::json & qc_get_array (const std::string &key, const nlohmann::json &json_obj) const
 
const nlohmann::json & qc_get_object (const std::string &key, const nlohmann::json &json_obj) const
 
unsigned long int qc_integer (const std::string &key, const nlohmann::json &json_obj) const
 

Static Public Member Functions

static std::string typeName (unsigned int t)
 

Detailed Description

Definition at line 42 of file JsonUtils.h.

Member Function Documentation

◆ get_as_json()

json cmr::JsonUtils::get_as_json ( const std::string & url) const

Utilizes the RemoteHttpResource machinery to retrieve the document referenced by the parameter 'url'. Once retrieved the document is fed to the RapidJSON parser to populate the parameter 'd'

Parameters
urlThe URL of the JSON document to parse.
Returns
The json document parsed from the source URL response..

Definition at line 58 of file JsonUtils.cc.

◆ get_str_if_present()

std::string cmr::JsonUtils::get_str_if_present ( const std::string & key,
const nlohmann::json & json_obj ) const

Get the

Parameters
key
json_obj
Returns

Definition at line 237 of file JsonUtils.cc.

◆ probe_json()

std::string cmr::JsonUtils::probe_json ( const nlohmann::json & j) const
Parameters
j
Returns

Definition at line 383 of file JsonUtils.cc.

◆ qc_boolean()

bool cmr::JsonUtils::qc_boolean ( const std::string & key,
const nlohmann::json & json_obj ) const

Tries to get the value of the json object named "key" as a bool.

Parameters
key
json_obj
Returns

Definition at line 136 of file JsonUtils.cc.

◆ qc_double()

double cmr::JsonUtils::qc_double ( const std::string & key,
const nlohmann::json & json_obj ) const

Tries to get the value of the json object named "key" as a double.

Parameters
key
json_obj
Returns

Definition at line 86 of file JsonUtils.cc.

◆ qc_get_array()

const nlohmann::json & cmr::JsonUtils::qc_get_array ( const std::string & key,
const nlohmann::json & json_obj ) const
Parameters
key
json_obj
Returns

Definition at line 288 of file JsonUtils.cc.

◆ qc_get_object()

const nlohmann::json & cmr::JsonUtils::qc_get_object ( const std::string & key,
const nlohmann::json & json_obj ) const
Parameters
key
json_obj
Returns

Definition at line 335 of file JsonUtils.cc.

◆ qc_integer()

unsigned long int cmr::JsonUtils::qc_integer ( const std::string & key,
const nlohmann::json & json_obj ) const

Tries to get the value of the json object named "key" as an unsigned long.

Parameters
key
json_obj
Returns

Definition at line 187 of file JsonUtils.cc.

◆ typeName()

std::string cmr::JsonUtils::typeName ( unsigned int t)
static

A wee helper method to convert type numbers to type strings

Parameters
t
Returns

Definition at line 73 of file JsonUtils.cc.


The documentation for this class was generated from the following files: