90 BESDEBUG(MODULE, prolog <<
"Key: '" << key <<
"' JSON: " << endl << json_obj.dump(2) << endl);
92 bool result = json_obj.is_object();
93 string msg0 = prolog +
"Json document is" + (result?
"":
" NOT") +
" an object.";
94 BESDEBUG(MODULE, msg0 << endl);
98 const auto &key_itr = json_obj.find(key);
99 if(key_itr == json_obj.end()){
102 msg <<
"Ouch! Unable to locate the '" << key;
103 msg <<
"' child of json: " << endl << json_obj.dump(2) << endl;
104 BESDEBUG(MODULE, msg.str() << endl);
108 auto &dobj = json_obj[key];
112 msg <<
"Failed to locate the '" << key;
113 msg <<
"' child of json: " << endl << json_obj.dump(2) << endl;
114 BESDEBUG(MODULE, msg.str() << endl);
117 if(!dobj.is_number_float() && !dobj.is_number()){
120 msg <<
"The child element called '" << key;
121 msg <<
"' is not a floating point value. json: " << endl << json_obj.dump(2) << endl;
122 BESDEBUG(MODULE, msg.str() << endl);
125 return dobj.get<
double>();
140 BESDEBUG(MODULE, prolog <<
"Key: '" << key <<
"' JSON: " << endl << json_obj.dump(2) << endl);
142 bool result = json_obj.is_object();
143 string msg0 = prolog +
"Json document is" + (result?
"":
" NOT") +
" an object.";
144 BESDEBUG(MODULE, msg0 << endl);
148 const auto &key_itr = json_obj.find(key);
149 if(key_itr == json_obj.end()){
152 msg <<
"Ouch! Unable to locate the '" << key;
153 msg <<
"' child of json: " << endl << json_obj.dump(2) << endl;
154 BESDEBUG(MODULE, msg.str() << endl);
158 auto &dobj = json_obj[key];
162 msg <<
"Failed to locate the '" << key;
163 msg <<
"' child of json: " << endl << json_obj.dump(2) << endl;
164 BESDEBUG(MODULE, msg.str() << endl);
167 if(!dobj.is_boolean()){
170 msg <<
"The child element called '" << key;
171 msg <<
"' is not boolean valued. json: " << endl << json_obj.dump(2) << endl;
172 BESDEBUG(MODULE, msg.str() << endl);
175 return dobj.get<
bool>();
189 unsigned long int value=0;
191 BESDEBUG(MODULE, prolog <<
"Key: '" << key <<
"' JSON: " << endl << json_obj.dump(2) << endl);
193 bool result = json_obj.is_object();
194 string msg0 = prolog +
"Json document is" + (result?
"":
" NOT") +
" an object.";
195 BESDEBUG(MODULE, msg0 << endl);
199 const auto &key_itr = json_obj.find(key);
200 if(key_itr == json_obj.end()){
203 msg <<
"Ouch! Unable to locate the '" << key;
204 msg <<
"' child of json: " << endl << json_obj.dump(2) << endl;
205 BESDEBUG(MODULE, msg.str() << endl);
209 auto &dobj = json_obj[key];
213 msg <<
"Failed to locate the '" << key;
214 msg <<
"' child of json: " << endl << json_obj.dump(2) << endl;
215 BESDEBUG(MODULE, msg.str() << endl);
218 if(!dobj.is_number_unsigned()){
221 msg <<
"The child element called '" << key;
222 msg <<
"' is not unsigned integer valued. json: " << endl << json_obj.dump(2) << endl;
223 BESDEBUG(MODULE, msg.str() << endl);
226 return dobj.get<
unsigned long>();
239 const string empty_string;
241 BESDEBUG(MODULE, prolog <<
"Key: '" << key <<
"' JSON: " << endl << json_obj.dump(2) << endl);
243 bool result = json_obj.is_object();
244 string msg0 = prolog +
"Json document is" + (result?
"":
" NOT") +
" an object.";
245 BESDEBUG(MODULE, msg0 << endl);
250 const auto &key_itr = json_obj.find(key);
251 if(key_itr == json_obj.end()){
254 msg <<
"Ouch! Unable to locate the '" << key;
255 msg <<
"' child of json: " << endl << json_obj.dump(2) << endl;
256 BESDEBUG(MODULE, msg.str() << endl);
260 auto &string_obj = json_obj[key];
261 if(string_obj.is_null()){
264 msg <<
"Failed to locate the '" << key;
265 msg <<
"' child of json: " << endl << json_obj.dump(2) << endl;
266 BESDEBUG(MODULE, msg.str() << endl);
269 if(!string_obj.is_string()){
272 msg <<
"The child element called '" << key;
273 msg <<
"' is not a string. json: " << endl << json_obj.dump(2) << endl;
274 BESDEBUG(MODULE, msg.str() << endl);
277 return string_obj.get<
string>();
290 BESDEBUG(MODULE, prolog <<
"Key: '" << key <<
"' JSON: " << endl << json_obj.dump(2) << endl);
292 bool result = json_obj.is_object();
293 string msg0 = prolog +
"Json document is" + (result?
"":
" NOT") +
" an object.";
294 BESDEBUG(MODULE, msg0 << endl);
299 const auto &key_itr = json_obj.find(key);
300 if(key_itr == json_obj.end()){
303 msg <<
"Ouch! Unable to locate the '" << key;
304 msg <<
"' child of json: " << endl << json_obj.dump(2) << endl;
305 BESDEBUG(MODULE, msg.str() << endl);
309 auto &array_obj = json_obj[key];
310 if(array_obj.is_null()){
313 msg <<
"Ouch! Unable to locate the '" << key;
314 msg <<
"' child of json: " << endl << json_obj.dump(2) << endl;
315 BESDEBUG(MODULE, msg.str() << endl);
318 if(!array_obj.is_array()){
321 msg <<
"ERROR: The child element called '" << key;
322 msg <<
"' is not an array. json: " << endl << json_obj.dump(2) << endl;
323 BESDEBUG(MODULE, msg.str() << endl);
337 BESDEBUG(MODULE, prolog <<
"Key: '" << key <<
"' JSON: " << endl << json_obj.dump(2) << endl);
340 bool result = json_obj.is_object();
341 string msg0 = prolog +
"Json document is" + (result?
"":
" NOT") +
" an object.";
342 BESDEBUG(MODULE, msg0 << endl);
347 const auto &key_itr = json_obj.find(key);
348 if(key_itr == json_obj.end()){
351 msg <<
"Ouch! Unable to locate the '" << key;
352 msg <<
"' child of json: " << endl << json_obj.dump(2) << endl;
353 BESDEBUG(MODULE, msg.str() << endl);
357 auto &child_obj = json_obj[key];
359 if(child_obj.is_null()){
362 msg <<
"Ouch! Unable to locate the '" << key;
363 msg <<
"' child of json: " << endl << child_obj.dump(2) << endl;
364 BESDEBUG(MODULE, msg.str() << endl);
367 if(!child_obj.is_object()){
370 msg <<
"ERROR: The child element called '" << key;
371 msg <<
"' is not an object. json: " << endl << child_obj.dump(2) << endl;
372 BESDEBUG(MODULE, msg.str() << endl);
385 string hdr0(
"#########################################################################################");
386 string hdr1(
"#- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -");
391 msg << j.dump(2) << endl;
393 msg <<
" j.is_null(): " << truth(j.is_null()) << endl;
394 msg <<
" j.is_object(): " << truth(j.is_object()) << endl;
395 msg <<
" j.is_array(): " << truth(j.is_array()) << endl;
397 msg <<
" j.is_discarded(): " << truth(j.is_discarded()) << endl;
398 msg <<
" j.is_string(): " << truth(j.is_string()) << endl;
399 msg <<
" j.is_structured(): " << truth(j.is_structured()) << endl;
400 msg <<
" j.is_binary(): " << truth(j.is_binary()) << endl;
401 msg <<
" j.is_boolean(): " << truth(j.is_boolean()) << endl;
402 msg <<
" j.is_number(): " << truth(j.is_number()) << endl;
403 msg <<
" j.is_number_float(): " << truth(j.is_number_float()) << endl;
404 msg <<
" j.is_number_integer(): " << truth(j.is_number_integer()) << endl;
405 msg <<
"j.is_number_unsigned(): " << truth(j.is_number_unsigned()) << endl;
406 msg <<
" j.is_primitive(): " << truth(j.is_primitive()) << endl;
407 msg <<
" j.size(): " << j.size()<< endl;
408 msg <<
" j.empty(): " << truth(j.empty()) << endl;