Hello guys i want to get Json array in fields,
I created 1 php file in a server and this php file to bring JSON data for the Product Informations, And after i wrote 1 apex code in Execute Anonymous and this code inside i want to get my fields but i couldnt reach,
As my following example
try
{
Http http = new Http();
HttpRequest RequestProductList = new HttpRequest();
RequestProductList.setEndPoint('388.221.34.12/ProductList.php');
RequestProductList.setMethod('GET');
RequestProductList.setTimeOut(120000);
RequestProductList.setHeader('Content-Type','application/json');
HttpResponse ResponseProductList = http.send(RequestProductList);
if (ResponseProductList.getStatusCode() == 200)
{
Map<String,Object> results = (Map<String,Object>) JSON.deserializeUntyped(ResponseProductList.getBody());
Map<String,Object> data = (Map<String,Object>) results.get('data');
List<Object> Products = (List<Object>) data.get('productList');
for(Object Prd: Products){
system.debug(Products(Prd['AverageInventory']));
***ErrorMessage: Expression must be a list type: Object***
How can i get this AverageInventory field ? or others,
}
}
}
catch (exception ex){
system.debug(ex);
}