【问题标题】:Corona not converting json to tableCorona没有将json转换为表格
【发布时间】:2015-05-28 06:24:12
【问题描述】:

我正在尝试将以下 json 对象转换为表格,但 Corona 未能这样做并为打印提供 0。我尝试用“”替换“__type”:“Object”以防止混淆,但没有运气。

   tempTable1 = '{"result":[{"__type":"Object","address":"95-97 Whitehorse Rd Blackburn VIC 3130","className":"allJobs","content":"Dr test","coord":{"__type":"GeoPoint","latitude":-37.817272,"longitude":145.149913},"createdAt":"2015-05-21T05:15:45.012Z","done":false,"email":"na","job":"psychologist","objectId":"PfKJkmIQKw","order":1,"phone":"0422031410","postcode":"3130","suburb":"Blackburn VIC","updatedAt":"2015-05-27T08:15:46.607Z","web":"na"},{"__type":"Object","address":"Suite 9 10-12 Prospect St Box Hill ","className":"allJobs","content":"Dr 2)","coord":{"__type":"GeoPoint","latitude":-37.817957,"longitude":145.118997},"createdAt":"2015-05-21T05:17:56.382Z","done":false,"email":"soboodi@yahoo.com","job":"lawyer","objectId":"xnLABEm5S4","order":1,"phone":"03 9890 0797","postcode":"3128","suburb":"Box Hill VIC","updatedAt":"2015-05-27T08:15:21.112Z","web":"na"}]}'


 local tables  = json.decode(tempTable1)
 print(#tables) 

【问题讨论】:

    标签: json coronasdk


    【解决方案1】:

    我以错误的方式调用结果。因为它在其他表中创建了一些表。以下是正确的。

    print (event.response.result[5].email)
    print (event.response.result[5].coord.latitude)
    

    【讨论】:

      猜你喜欢
      • 2021-02-25
      • 2012-05-03
      • 2015-09-02
      • 2013-07-02
      • 2019-12-12
      • 2020-05-09
      • 1970-01-01
      相关资源
      最近更新 更多