Not a problem, happy to help
If you explicitly specify the first element of an array as the root object, then you won't be able to work with multiple objects in that array. So that's not what you want.
However, even if the root object you are working with has other JS objects or arrays several levels deep, you can still work with them, but you have to manually specify the attributes you need using the "JSON Data Attributes" field.
For example:
Suppose you want to print a list of events from Eventbrite. You want to print the event title, date, description, organiser and the price of tickets.
Firstly, the events are located in an array called "events", so that's what you should put into the "JSON Root Object" field. Next, use JS "notation" to enter a newline-separated list of the attributes you want relative to the root object you've specified. So in this case, that would be:
- event.title
[*]event.start_date
[*]event.description
[*]event.tickets[0].ticket.price
[*]event.organizer.name
After entering that into the "JSON Data Attributes", you should get a list of available keywords that look like this:
Keyword Description
%ds__event% Record Set Attribute : event
%ds__event.title% Record Set Attribute : event.title
%ds__event.start_date% Record Set Attribute : event.start_date
%ds__event.description% Record Set Attribute : event.description
%ds__event.tickets_0.ticket.price% Record Set Attribute : event.tickets_0.ticket.price
%ds__event.organizer.name% Record Set Attribute : event.organizer.name
If you go to the details screen of one of the top data source record, you should see:
Record Set Is:
event {"box_header_text_color":"005580","link_color":"EE6600","box_background_color":"FFFFFF","timezone":"Australia\/Sydney","box_border_color":"D5D5D3","logo":"http:\/\/ebmedia.eventbrite.com\/s3-s3\/eventlogos\/17896083\/2973703427-1.png","organizer":{"url":"http:\/\/parracity.eventbrite.com","description":"","id":1323501107,"name":"Parramatta City Council"},"background_color":"FFFFFF","id":2147483647,"category":"testing,other","box_header_background_color":"EFEFEF","capacity":0,"num_attendee_rows":0,"title":"API Test Event","start_date":"2012-03-27 07:00:00","status":"Live","description":"API Test Event Details","end_date":"2012-03-27 23:00:00","tags":"API, test","text_color":"005580","title_text_color":"","tickets":[{"ticket":{"description":"API Test Description","end_date":"2012-03-29 12:00:00","min":1,"max":2,"price":"0.00","visible":"true","start_date":"2012-02-15 01:00:00","currency":"AUD","type":0,"id":13006683,"name":"API Test Ticket"}}],"created":"2012-02-15 19:46:35","url":"http:\/\/www.eventbrite.com\/event\/2973703427","box_text_color":"000000","privacy":"Public","venue":{"city":"Parramatta","name":"Parramatta City Council","country":"Australia","region":"New South Wales","longitude":151.010816,"postal_code":"2150","address_2":"","address":"30 Darcy St","latitude":-33.788676,"country_code":"AU","id":1162333,"Lat-Long":"-33.788676 \/ 151.010816"},"modified":"2012-02-15 20:16:55","logo_ssl":"https:\/\/ebmedia.eventbrite.com\/s3-s3\/eventlogos\/17896083\/2973703427-1.png","repeats":"no"}
event.title API Test Event
event.start_date 2012-03-27 07:00:00
event.description API Test Event Details
event.tickets_0.ticket.price 0.00
event.organizer.name Parramatta City Council
All the attributes we specified in the list should now be visible on the details screen and have data in them.
Note that in the example above I assumed there is only one ticket type (as I'm pulling just the first ticket price, using event.tickets[0].ticket.price). If you wanted to iterate over the ticket types as well, it's starting to get complicated so there are two things you could do:
[list=1]
[*]Use two JSON Data Source assets; one with a dynamic root node of session variable "list_current_asset_id" so that in a listing you could pull in the "event.tickets" JSON data and list it (a bit complicated)
[*]Or, more appropriately, use a REST Resource JS asset to point at the Eventbrite feed first. You can then use server-side JavaScript to manipulate the feed, ouputting only the information you need in a flat JSON array. The JSON Data Source asset is then designed to be able to point at this REST asset. This gives you powerful data processing ability with the flexbility of using an asset listing for the presentation.
[/list]
Hope this helps :)