mirror of
https://github.com/json-c/json-c.git
synced 2026-03-25 16:09:06 +08:00
Merge pull request #220 from hschaa/master
Add utility function for comparing json_objects
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user