A
A
Alexander Andropov2021-10-21 23:16:30
Python
Alexander Andropov, 2021-10-21 23:16:30

How to compare values ​​in two JSON objects?

Good day friends. I have JSON which contains data

"data":{"name":"Alex","age":19,"city":"Abakan"},{"name":"Rose","age":29,"city":"Astrahan"}

I also get the same JSON from the database, but the data there may already have changed, for example, age or city.
Please tell me how can I correctly compare these two objects (values ​​in them) and if the value from the database is different (json No. 2), then change it to json No. 1.

There are more than 30 such records, how to compare these data correctly?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
RRRRRRR7, 2021-10-22
@RRRRRRRR7

diff(json1, json2) I think it should help.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question