I have a JSON file like
{
"object1": {
"key_1": "value_1",
"key_2": "value_2",
"key_3": "value_3"
},
"object2": {
"key_1": "value_1",
"key_4": "value_4"
}
}
I have to find out duplicate key value pairs from these JSON objects, e.g: first object "object1", I have "key_1":"value_1" which is also present in "object2", in that case I need to print message for containing duplicate key value pairs in the JSON file.
I tried to read each key value pair and store same key value pair in HashMap, before storing, I am checking whether same key value pair already exists in the HashMap or not, once I encountered any duplicate key value pair, I am printing message.
My question is, for achieving same thing, do we have any open source java library?
Library Josson can transform the JSON.
https://github.com/octomix/josson
Output