miloyip / nativejson-benchmark

C/C++ JSON parser/generator benchmark
MIT License
1.95k stars 262 forks source link

How to merge two json array using C++? #153

Open DhanushQH opened 2 years ago

DhanushQH commented 2 years ago

I want to merge given JSON object into existing JSON object using C++. My JSON object contains Array elements

This is my existing JSON object : {
"FeatureReports": { "ProductInformation": { "ProductName": "E_Portal" }, "Reports": [ { "user_purchase": [ { "sr_no": 1, "ItemName": "TV" }, { "sr_no": 2, "ItemName": "AC" } ] }, { "User_Sell": [ { "sr_no": 1, "ItemName": "Refrigerator" } ] } ] } } Now, I want to add/update user_purchase array elements. Steps need to check :

  1. If Data exist, then update it and ignor duplicate data.
  2. If Data not exist added it into Reports array How can i write C++ code for this ?