JsonBlock¶
IsIdentical¶
bool IsIdentical(const JsonBlock& other) const
This will compare two JsonBlock objects, whether they are semantically identical or not.
What does this mean? It basically checks whether two JsonBlock objects hold the same information.
For example, these two JsonBlocks 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 (like in child objects)!
Arrays will preserve their order!
These two JsonBlocks would NOT be semantically identical:
{
"name": "Peter Griffin",
"age": 52
}
{
"age": 51,
"name": "Peter Griffin"
}
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
myJsonBlock == myOtherJsonBlock
myJsonBlock != myOtherJsonBlock
This is basically the inverse ("IsNotIdentical").