Comparing two JSON files in UiPath Studio

How can we automate comparing of two JSON files, without selecting them manually from project section.

Hey,
Please go through this post it will help you

Thanks

How do I parse both json objects together. In for each loop I am not able to put and condition also.

Hey
Use Deserialize JSON activity. It will give the value in Json object format then iterate and apply condition if name matches. Use write cell activity to write

Thanks
Rounak

I am not able to get how to iterate through both JSONs. In one loop it is not possible, so if I iterate them separately then how to compare the values from both files.

Hi @aditit

Can you share us sample json file here.

Regards
Gokul

Hi @aditit - How about converting the JSONs to datatable then comparing. The final output can be converted back to JSON. It would be helpful if you can share a JSON samples

The other file will be of same type with same or different values.

@aditit - It would be helpful if you could share a json file instead of screenshot. Also, please explain us what are the fields that you want to compare

We are still not able to resolve it. Can you please go through this link, sample json files are there and help us.
Comparing two JSON files and noting their differences - Help / Studio - UiPath Community Forum
Thank You

Below are my two JSON files. ‘order’ data needs to be compared with ‘old’ data and I need to output the difference from both files, i.e., the old value and order value. Please help me in doing that.
old.json (949 Bytes)
order.json (942 Bytes)

Hi @aditit - Please check the attached workflow

Example.zip (5.1 KB)

image
It is showing some missing activity.

@aditit Please do install UiPath.WebAPI. Activities

Capture

It is just giving the difference from two columns. How can I iterate through whole json file without manually entering the label names like “Order Date” is manually entered here.

I have two json files in JARRAY format, I need to store the JSON into the dictionary in key value pair. But I don’t Know how to do that.
order.json (942 Bytes)
old.json (949 Bytes)
These are the two jsons I need to compare. I need this in key value pair

Hi @agathiyanv - Can you let us know what are the values you want to compare

Hello @agathiyanv ,

Have a look at this Post

@agathiyanv
not all is clear from your request

as we would have also keys with the same name in the different dictionaries (JObject property Names) and when flatten it down we would conflict with the key name uniqnes.

But have a look here on how we deserialized the JSON string into a list of dictionaries (string, Object)


JsonConvert.DeserializeObject(Of List(Of Dictionary(Of String, Object)))(strJSON)

I need to compare the two json files and store the differences in separate json file