Can you help me to parse a JSON file in a array so that I can iterate over it and display the contents on my lightning component?

Getting the JSON response from here: https://api.airbnb.com/v2/search_results?client_id=3092nxybyb0otqw18e8nh5nty&location=dublin

Now I need to show the listings object as a list on the component using aura:iteration attribute.

Any help?


2 Answers 2


If you mean on the client side, then its just:

var json = ...;

var parsed = JSON.parse(json);
var results = parsed.search_results;
component.set("v.listings", results);

I guess before parse once go stringify then parse like.

var obj;
var jsonString = JSON.parse(JSON.stringify(obj));
// Now you getting the parse format json.
component.set('v.returnData', jsonString);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.