English 中文(简体)
Corona SDK: parsing JSON
原标题:Corona SDK: parsing JSON

I have a JSON string which I can parse with Corona SDK. What I could not figure out yet is how to use the return value and assign it to a variable which I can access later?

我担任这一职务:

    local function networkListener( event )
        if ( event.isError ) then
                print( "Network error!")
        else            
                print ( "RESPONSE: " .. event.response )
        end
end

收益价值如下:

[{"id":"25761","name":"Legend Of Zelda: Ocarina Of Time 3D, The","cnt":"15"},{"id":"26106","name":"Zelda No Densetsu: Toki No Ocarina 3D","cnt":"15"}]

我如何从这一收益价值中得出一个表? 增 编

最佳回答
require "json"

local t = json.decode( jsonFile( "sample.json" ) )

探索名人 Usage in Corona

问题回答

暂无回答




相关问题
JQuery/MVC Search Issue

I have inherited a piece of work where the entry screen shows a summary of 20 calculated variables. E.g. Var A (250), Var B (79). Clicking on any of these links takes the user to a view with a ...

jQuery quicksearch plug-in tinkering with JSON

I ve implemented the quicksearch plugin by Rik Lomas and I love it for an application in a custom CMS I m building. I was wondering though, since I m going to have a bizillion items in the table if ...

JSON with classes?

Is there a standardized way to store classes in JSON, and then converting them back into classes again from a string? For example, I might have an array of objects of type Questions. I d like to ...

PHP json_decode question

i m trying to use json_decode to combine a few json objects and then re-encode it. my json looks like: { "core": { "segment": [ { "id": 7, "...

Converting JSON data to Java object

I want to be able to access properties from a JSON string within my Java action method. The string is available by simply saying myJsonString = object.getJson(). Below is an example of what the string ...

热门标签