0

My Format

  { 
      "iList": [
        {
          "ADDRESS1": "string",
          "CITY": "string",
          "COUNTRY": "string",
          "EMAIL_ADDRESS": "string",
           "FIRST_NAME": "string",
         
          "LAST_NAME": "string",
          "PRIMARY_PHONE_NUMBER": "string",
          "STATE_PROVINCE": "string",
          "ZIP_CODE": "string"
        }
      ],
      "iaList": [
        {
          "ATTRIBUTE_NAME": "string",
          "CUSTOM_PERMISSION": "string",
          "Id": "string",
          "GLOBAL_PERMISSION": "string"
        },
       {
          "ATTRIBUTE_NAME": "string",
          "CUSTOM_PERMISSION": "string",
          "Id": "string",
          "GLOBAL_PERMISSION": "string"
        },
    
    {
          "ATTRIBUTE_NAME": "string",
          "CUSTOM_PERMISSION": "string",
          "Id": "string",
          "GLOBAL_PERMISSION": "string"
        }
    
    
      ],
      "Uplift": [
        {
          "AGE": 0,
          "AUTOMOBILE": "string",
          "CHILD_AGES": "string",
          "DATE_OF_BIRTH": "string",
          "EDUCATION": "string",
          "GENDER": "string",
        }
      ]
    }   

I have created a main model class with List and each individual model class. But i have no idea of doing iaList. How can i pass multiple json object inside json array . Please anyone help me

vijju
  • 462
  • 9
  • 30
  • *How can i pass multiple json object inside json array* - does [this](https://stackoverflow.com/questions/18983185/how-to-create-correct-jsonarray-in-java-using-jsonobject) answer you question? – Tamir Abutbul Nov 09 '20 at 08:47
  • @Tamir how can I pass that whold json object to API – vijju Nov 09 '20 at 08:55
  • JsonObject mainJsonObject = new JsonObject(); JsonArray jsonArray1 = new JsonArray(); jsonArray1.add(youriList): mainJsonObject.add("iList", jsonArray1); JsonArray jsonArray2 = new JsonArray(); jsonArray2.add(youriaList): mainJsonObject.add("iaList", jsonArray2); JsonArray jsonArray3 = new JsonArray(); jsonArray3.add(yourUplift): mainJsonObject.add("Uplift", jsonArray3); and Pass mainJsonObject to api – piyushpk Nov 09 '20 at 10:26
  • Does this answer your question? [How to create correct JSONArray in Java using JSONObject](https://stackoverflow.com/questions/18983185/how-to-create-correct-jsonarray-in-java-using-jsonobject) – leonheess Nov 10 '20 at 08:14

0 Answers0