Fetching the JSON array objects through javaScript

<script>
var dictionary = {
    "treatmentApplicationGroupDataList":[
        {
            "applicationGroupId": 879545457291368,
            "treatments": [
                {
                    "treatmentId": 879545457291370,
                    "treatmentId": 879545457291371
                }
            ]
        }
    ]  
};

var treatmentApplicationGroupDataList = dictionary.treatmentApplicationGroupDataList;
 
	for ( var i in treatmentApplicationGroupDataList) {
    
		var applicationGroupId = treatmentApplicationGroupDataList[i].applicationGroupId;
        document.write("applicationGroupId : " +applicationGroupId +"<br/>");
    }   
    
    for (var i in treatmentApplicationGroupDataList){         
         var treatments = treatmentApplicationGroupDataList[i].treatments[i]; 
          
          for(var j in treatmentApplicationGroupDataList[])
          document.write(" --- treatmentId : " +treatments+"<br/>");
          
		 
    }
        
	
 
</script>

is there a problem? despite using for…in on an array and document.write()

Yes. I want output like below;
applicationGroupId: { treatmentId }

i.e. { 879545457291368: {879545457291370} , 879545447124032: {879545447124036, 879545447124034 } }

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.