[SalesForce] Parse a JSON and use it in Lightning

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?

Best Answer

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);