【问题标题】:Corona SDK: parsing JSONCorona SDK:解析 JSON
【发布时间】:2011-12-18 02:59:26
【问题描述】:

我有一个 JSON 字符串,我可以用 Corona SDK 解析它。 我还没有弄清楚如何使用返回值并将其分配给我以后可以访问的变量?

我在这个函数中得到了 JSON 字符串:

    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"}]

如何根据该返回值制作表格?谢谢

【问题讨论】:

    标签: json coronasdk


    【解决方案1】:
    require "json"
    
    local t = json.decode( jsonFile( "sample.json" ) )
    

    Exploring JSON Usage in Corona

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-12-23
      • 2015-09-18
      • 1970-01-01
      • 1970-01-01
      • 2012-11-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多