0
我使用cjson
来解码以下JSON。我想测试items参数为null的情况。我很难找到符合这种情况的条件。这很奇怪,因为它似乎不是一个字符串,不是零,但stil具有真正的价值。Lua cjson测试null
{
"kind": "ServiceList",
"apiVersion": "v1",
"metadata": {
"selfLink": "/api/v1/services",
"resourceVersion": "47316"
},
"items": null
}
这里是我已经尝试了条件语句:
if jsonServices.items == "null" then
if jsonServices.items == null then
if not jsonServices.items then
if jsonServices.items == nil
'print(jsonServices.items)'显示什么? – lhf