MACSio  0.9
Multi-purpose, Application-Centric, Scalable I/O Proxy App
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages

JSON object hierarchy path query convenience macros. More...

Macros

#define JsonGetBool(OBJ,...)   json_object_apath_get_boolean(OBJ, json_paste_apath(#__VA_ARGS__, __VA_ARGS__))
 Get the bool value at specified path. More...
 
#define JsonGetInt(OBJ,...)   json_object_apath_get_int( OBJ, json_paste_apath(#__VA_ARGS__, __VA_ARGS__))
 Get the int value at specified path. More...
 
#define JsonGetInt64(OBJ,...)   json_object_apath_get_int64( OBJ, json_paste_apath(#__VA_ARGS__, __VA_ARGS__))
 Get the int64_t value at specified path. More...
 
#define JsonGetDbl(OBJ,...)   json_object_apath_get_double( OBJ, json_paste_apath(#__VA_ARGS__, __VA_ARGS__))
 Get the double value at specified path. More...
 
#define JsonGetStr(OBJ,...)   json_object_apath_get_string( OBJ, json_paste_apath(#__VA_ARGS__, __VA_ARGS__))
 Get the string value at specified path. More...
 
#define JsonGetObj(OBJ,...)   json_object_apath_get_object( OBJ, json_paste_apath(#__VA_ARGS__, __VA_ARGS__))
 Get the object at specified path. More...
 
#define JsonFindObj(OBJ,...)   json_object_apath_find_object(OBJ, json_paste_apath(#__VA_ARGS__, __VA_ARGS__))
 
#define JsonGetBool(OBJ,...)   json_object_apath_get_boolean(OBJ, json_paste_apath(#__VA_ARGS__, __VA_ARGS__))
 Get the bool value at specified path. More...
 
#define JsonGetInt(OBJ,...)   json_object_apath_get_int( OBJ, json_paste_apath(#__VA_ARGS__, __VA_ARGS__))
 Get the int value at specified path. More...
 
#define JsonGetInt64(OBJ,...)   json_object_apath_get_int64( OBJ, json_paste_apath(#__VA_ARGS__, __VA_ARGS__))
 Get the int64_t value at specified path. More...
 
#define JsonGetDbl(OBJ,...)   json_object_apath_get_double( OBJ, json_paste_apath(#__VA_ARGS__, __VA_ARGS__))
 Get the double value at specified path. More...
 
#define JsonGetStr(OBJ,...)   json_object_apath_get_string( OBJ, json_paste_apath(#__VA_ARGS__, __VA_ARGS__))
 Get the string value at specified path. More...
 
#define JsonGetObj(OBJ,...)   json_object_apath_get_object( OBJ, json_paste_apath(#__VA_ARGS__, __VA_ARGS__))
 Get the object at specified path. More...
 
#define JsonFindObj(OBJ,...)   json_object_apath_find_object(OBJ, json_paste_apath(#__VA_ARGS__, __VA_ARGS__))
 

Detailed Description

JSON object hierarchy path query convenience macros.

These convenience macros free the caller from having to sprintf the key_paths used in alternative path methods. This is all the more important for code blocks utilizing local variables to hold indices into intermediate arrays.

If a local variable, say i, holds an array index for the array "/foo/bar" in the JSON object, the caller can use the macro JsonGetInt(obj, "/foo/bar", i) to obtain the value of the ith member of that array. These macros work with intermediate arrays too. So, for example, in the call JsonGetInt(obj, "/foo/bar", i, "gorfo", 32, k, "dims"), suppose local variables i==16 and k==11, then the macro will automatically construct the key path "/foo/bar/16/gorfo/32/11/dims" and then query the object with this path.

These macros are by far the easiest way to query and traverse a large JSON-C object.

Macro Definition Documentation

#define JsonGetBool (   OBJ,
  ... 
)    json_object_apath_get_boolean(OBJ, json_paste_apath(#__VA_ARGS__, __VA_ARGS__))

Get the bool value at specified path.

Returns
For return value and type corecion see json_object_path_get_boolean().

Definition at line 741 of file json_object.h.

#define JsonGetInt (   OBJ,
  ... 
)    json_object_apath_get_int( OBJ, json_paste_apath(#__VA_ARGS__, __VA_ARGS__))

Get the int value at specified path.

Returns
For return value and type corecion see json_object_path_get_int().

Definition at line 747 of file json_object.h.

#define JsonGetInt64 (   OBJ,
  ... 
)    json_object_apath_get_int64( OBJ, json_paste_apath(#__VA_ARGS__, __VA_ARGS__))

Get the int64_t value at specified path.

Returns
For return value and type corecion see json_object_path_get_int64().

Definition at line 753 of file json_object.h.

#define JsonGetDbl (   OBJ,
  ... 
)    json_object_apath_get_double( OBJ, json_paste_apath(#__VA_ARGS__, __VA_ARGS__))

Get the double value at specified path.

Returns
For return value and type corecion see json_object_path_get_double().

Definition at line 759 of file json_object.h.

#define JsonGetStr (   OBJ,
  ... 
)    json_object_apath_get_string( OBJ, json_paste_apath(#__VA_ARGS__, __VA_ARGS__))

Get the string value at specified path.

Returns
For return value and type corecion see json_object_path_get_string().

Definition at line 765 of file json_object.h.

#define JsonGetObj (   OBJ,
  ... 
)    json_object_apath_get_object( OBJ, json_paste_apath(#__VA_ARGS__, __VA_ARGS__))

Get the object at specified path.

Returns
For return and type corecion see json_object_path_get_any().

Definition at line 771 of file json_object.h.

#define JsonFindObj (   OBJ,
  ... 
)    json_object_apath_find_object(OBJ, json_paste_apath(#__VA_ARGS__, __VA_ARGS__))

Definition at line 772 of file json_object.h.

#define JsonGetBool (   OBJ,
  ... 
)    json_object_apath_get_boolean(OBJ, json_paste_apath(#__VA_ARGS__, __VA_ARGS__))

Get the bool value at specified path.

Returns
For return value and type corecion see json_object_path_get_boolean().

Definition at line 742 of file json_object.h.

#define JsonGetInt (   OBJ,
  ... 
)    json_object_apath_get_int( OBJ, json_paste_apath(#__VA_ARGS__, __VA_ARGS__))

Get the int value at specified path.

Returns
For return value and type corecion see json_object_path_get_int().

Definition at line 748 of file json_object.h.

#define JsonGetInt64 (   OBJ,
  ... 
)    json_object_apath_get_int64( OBJ, json_paste_apath(#__VA_ARGS__, __VA_ARGS__))

Get the int64_t value at specified path.

Returns
For return value and type corecion see json_object_path_get_int64().

Definition at line 754 of file json_object.h.

#define JsonGetDbl (   OBJ,
  ... 
)    json_object_apath_get_double( OBJ, json_paste_apath(#__VA_ARGS__, __VA_ARGS__))

Get the double value at specified path.

Returns
For return value and type corecion see json_object_path_get_double().

Definition at line 760 of file json_object.h.

#define JsonGetStr (   OBJ,
  ... 
)    json_object_apath_get_string( OBJ, json_paste_apath(#__VA_ARGS__, __VA_ARGS__))

Get the string value at specified path.

Returns
For return value and type corecion see json_object_path_get_string().

Definition at line 766 of file json_object.h.

#define JsonGetObj (   OBJ,
  ... 
)    json_object_apath_get_object( OBJ, json_paste_apath(#__VA_ARGS__, __VA_ARGS__))

Get the object at specified path.

Returns
For return and type corecion see json_object_path_get_any().

Definition at line 772 of file json_object.h.

#define JsonFindObj (   OBJ,
  ... 
)    json_object_apath_find_object(OBJ, json_paste_apath(#__VA_ARGS__, __VA_ARGS__))

Definition at line 773 of file json_object.h.