Skip to content
JsonArray

IsIdentical

bool IsIdentical(const JsonArray& other) const

This will compare two JsonArray objects, whether they are semantically identical or not.

What does this mean? It basically checks whether two JsonArray objects hold the same information.

For example, these two arrays would be semantically identical:

[ 1, 2, 3, 4, 5]
[ 1, 2, 3, 4, 5]

These two are NOT semantically identical:

[ 1, 2, 3, 4, 5]
[ 5, 4, 3, 2, 1]

These two, again, are semantically identical

[
    {
        "age": 17,
        "name": "Belle Whale"
    }
]
[
    {
        "name": "Belle Whale",
        "age": 17
    }
]

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

  • myArray == myOtherArray
  • myArray != myOtherArray This is basically the inverse ("IsNotIdentical").