JsonData¶
IsIdentical¶
bool IsIdentical(const JsonData& other) const
This will compare two JsonData objects, whether they are semantically identical or not.
What does this mean? It basically checks whether two JsonData objects hold the same information.
For example, these two Json objects would be semantically identical, even though one is in a different order:
{
"name": "Peter Griffin",
"age": 52
}
{
"age": 52,
"name": "Peter Griffin"
}
This does not apply for arrays!
Arrays will preserve their order!
Value comparisons¶
Even if all fields are present, IsIdentical()
will still return false, if at least one field has a differing value.
What about floating points?¶
We can of course not compare floating points the same, because every floating point will differ in the very small digits.
Floating points will only be compared up to a certain accuracy, for example 10 digits.
You can set this accuracy globally via JASONPP_FLOAT_PRECISION
and per individual JsonData (and all of its children) via SetFloatPrecision()
.
Also, it will just ignore whether a numeric is of type INT
or of type FLOAT
.
It would see 5.0 and 5 as equal.
Aliases¶
Alternative ways to call this function
myJsonData == myOtherJsonData
myJsonData != myOtherJsonData
This is basically the inverse ("IsNotIdentical").