JSON: Array, dictionary.. slightly confused

Hi there team

Long time reader, first time poster.

Am having a lot of fun digging in with Corona SDK as a first-timer, but yesterday I felt I was beating my head against a wall, and possibly missing something really simple. I’m throwing myself on the mercy of the experts here.

With my code currently, if I am referencing the commented-out JSON file (world_names.json), I have no problems referencing & diplaying certain values, (the commented out displaynewText there works fine,). I understand that particular file has been read in as an array. 

However my issue is with the other file (matches.json). My understanding from searching and reading, is that because of the way this json file is formatted, this is a dictionary rather than an array, and needs to be deserialized? I have tried a number of solutions posted in various posts, but always I’m getting a ‘nil’ result or error. 

My question is, how am I able to display certain values, (the value of the 2nd match_id for exmaple,) as I can with world_names, using the ‘matches.json’ file.

Thanks for taking to the time to read, I hope this made some sense, and hopefully the answer is something really obvious and simple! :slight_smile:

[lua]local function networkListener2( event )
    if ( event.isError ) then

        print( “Sorry, we can’t reach the servers!”)

        else

        – print ( "RESPONSE: " … event.response )

        local json = require “json”

        local worlds = json.decode( event.response )

        – No sure how to reference a dictionary?

        – display.newText( worlds[6].name, 80, 120, “Helvetica”, 32 )

    end

end

local function getAllMatchups ()

    – local json_file_by_get = jsonFile( network.request( “https://api.guildwars2.com/v1/world_names.json”, “GET”, networkListener2) )

    local json_file_by_get = jsonFile( network.request( “https://api.guildwars2.com/v1/wvw/matches.json”, “GET”, networkListener2) )
end[/lua]