Merge pull request #220 from hschaa/master

Add utility function for comparing json_objects
This commit is contained in:
Eric Haszlakiewicz
2016-04-30 14:42:16 -04:00
7 changed files with 273 additions and 0 deletions

View File

@@ -696,6 +696,26 @@ extern const char* json_object_get_string(struct json_object *obj);
*/
extern int json_object_get_string_len(const struct json_object *obj);
/** Check if two json_object's are equal
*
* If the passed objects are equal 1 will be returned.
* Equality is defined as follows:
* - json_objects of different types are never equal
* - json_objects of the same primitive type are equal if the
* c-representation of their value is equal
* - json-arrays are considered equal if all values at the same
* indices are equal (same order)
* - Complex json_objects are considered equal if all
* contained objects referenced by their key are equal,
* regardless their order.
*
* @param obj1 the first json_object instance
* @param obj2 the second json_object instance
* @returns whether both objects are equal or not
*/
extern int json_object_equal(struct json_object *obj1,
struct json_object *obj2);
#ifdef __cplusplus
}
#endif