i have to implement json data in my application. but i can't get it how to fetch data from server. i am using ION library.
{
"search": [{
"id": "5454003",
"description": "Larger Than Life",
"url": "http://audiojungle.net/item/larger-than-life/5454003",
"type": "item",
"sales": "1469",
"rating": "5",
"item_info": {
"id": "5454003",
"item": "Larger Than Life",
"url": "http://audiojungle.net/item/larger-than-life/5454003",
"user": "pinkzebra",
"thumbnail": "https://0.s3.envato.com/files/67162834/upbeatsongwinner2.jpg",
"sales": "1469",
"rating": "5",
"rating_decimal": "4.96",
"cost": "18.00",
"preview_type": "audio",
"preview_url": "https://0.s3.envato.com/files/94250640/preview.mp3",
"length": "2:35"
}
} ] }
this is my json data. i want to display in my application data like "cost" , "user" ect. but i didn't get it. ion code is here,
Ion.with(this)
.load("http://marketplace.envato.com/api/edge/search:audiojungle,,happy.json")
.asJsonObject().setCallback(new FutureCallback<JsonObject>() {
@Override
public void onCompleted(Exception arg0, JsonObject data) {
// TODO Auto-generated method stub
}
});
so if anybody knows then please help me. thank you in advance.
EDIT: The first info that you posted was has some misleading information, i checked the answer that you posted and i have a working code for you,
code:
To parse the response data:
check your logs .
Process :
Edited :
first : you have to find "search" array , after it use indexing to get its object , so now you have JsonObject , from it get "item_info" object , from there you can find "id" object .