{
      installedApplications {
        id: 16
        aid: 4539749
        appName: "A31-RT1"
        description: "A31-RT1"
        applicationLogoUrl: "/applications/16/applicationlogo"
        applicationCompanyOrBusinessLogoUrl: "/applications/16/companyorbusinesslogo"
        appProviderName: ""
        appProviderPersoEndpointUrl: ""
        appProviderDeleteEndpointUrl: ""
        androidAppPackageName: "N"
        isUnpublished: false
        isInstallationAllowed: true
        isApprovedForSharedSlot: false
        lastUpdatedDate: -1
        contactEmail: "pallavi.shanmukhaiah@nxp.com"
        linkToTermsAndConditions: ""
        linkToApplicationWebsite: ""
        applicationSize: 288
        businessSegment: "Infrastructure"
        supportedCardLogoUris: "/applications/3/supportedcards/53/cardlogo"
        21: 0
      }
 i tried many times but i am not able to excess the id and aid ?
please help me to write an code to parse this json format.      
            Asked
            
        
        
            Active
            
        
            Viewed 46 times
        
    -4
            
            
         
    
    
        Nikhil Gupta
        
- 1
- 3
- 
                    5Possible duplicate of [How to parse JSON in Java](https://stackoverflow.com/questions/2591098/how-to-parse-json-in-java) – Absent Feb 27 '19 at 06:37
- 
                    What you posted is not valid JSON. There should be a `:` after `installedApplications` and the fields should be separated by commas, not newlines. – Jesper Feb 27 '19 at 08:06
- 
                    This is the only response i'm getting , i cannot change the format of the JSON. @Jesper – Nikhil Gupta Feb 27 '19 at 08:42
- 
                    1If this is really exactly what you are getting, then it's not JSON, but something that just superficially looks like JSON. You won't be able to parse this with a JSON parser - you'll have to write a parser for it yourself. – Jesper Feb 27 '19 at 09:43
1 Answers
0
            
            
        JSONObject obj = new JSONObject();
You have the obj with you so go ahead like:
int id = (int) obj.getJSONObject("installedApplications").get("id");
int aid = (int) obj.getJSONObject("installedApplications").get("aid");
I hope this helps.
 
    
    
        Nilanjan Bhadury
        
- 373
- 2
- 8