You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have an application that is using JSON objects to store a set of parameters of different types. I refer to these objects as 'parameter bags'. When I set (change) the value of a parameter that is already in the bag, I want to also check to see if the new parameter value is different than the current value (is the value changing, the bag becomes 'dirty').
For simple types like floats and strings, I assume the check is very straight forward and efficient, however I am concerned about the efficiency of checking equivalency for arrays and parameters that themselves are JSON objects. Can anyone share with me any insight they may have concerning the best way to compare two JSON objects? IS a simple Obj1 == Obj2 the best way to go?
Thanks in advance!
Jim
The text was updated successfully, but these errors were encountered:
JSON arrays are stored as std::vector, and JSON objects as std::map. Comparing two JSON values with operator== checks equality based on the C++ types. So, yes, applying Obj1 == Obj2 is the best way to go.
Hello All-
I have an application that is using JSON objects to store a set of parameters of different types. I refer to these objects as 'parameter bags'. When I set (change) the value of a parameter that is already in the bag, I want to also check to see if the new parameter value is different than the current value (is the value changing, the bag becomes 'dirty').
For simple types like floats and strings, I assume the check is very straight forward and efficient, however I am concerned about the efficiency of checking equivalency for arrays and parameters that themselves are JSON objects. Can anyone share with me any insight they may have concerning the best way to compare two JSON objects? IS a simple Obj1 == Obj2 the best way to go?
Thanks in advance!
Jim
The text was updated successfully, but these errors were encountered: