0

I have a jsonarray like below:

 [
   {
      "WarrantyGuarantee":{
         "Row Id":"RA048",
         "QuestionKey":"WarrantyGuarantee",
         "Answer":"Y"
      }
   },
   {
      "RewardLoyalty":{
         "Row Id":"RA051",
         "QuestionKey":"RewardLoyalty",
         "Answer":"Y"
      }
   },
   {
      "WarrantyGuarantee":{
         "Row Id":"RA048",
         "QuestionKey":"WarrantyGuarantee",
         "Answer":"Y"
      }
   },
   {
      "RewardLoyalty":{
         "Row Id":"RA051",
         "QuestionKey":"RewardLoyalty",
         "Answer":"Y"
      }
   },
   {
      "MinCost":{
         "Row Id":"RA044",
         "QuestionKey":"MinCost",
         "Answer":"hgf"
      }
   }
]

I also have multiple json objects:

  {
   "RA048":"Y",
   "RA051":"Y"
  }

and

 {
   "RA049":"Y",
   "RA051":"N"
 }

I want to merge all my json objects in the jsonarray from the above.

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
  • https://stackoverflow.com/questions/17810044/android-create-json-array-and-json-object – ADM Mar 26 '18 at 11:27

1 Answers1

0
JSONObject jo = new JSONObject();
JSONArray array = new JSONArray();
jo.put("key",(Object)array);

Use this method.

Bineesh P Babu
  • 268
  • 1
  • 14