JSON Util¶
Create Util
json_util = util('json')
Method¶
table_to_json¶
response = json_util:table_to_json(request)
if response.isError then
-- エラー処理 --
print(response.statusCode)
print(response.errorMessage)
else
-- 正常処理 --
print(response.result)
end
LuaテーブルをJSONフォーマットのテキストに変換します。
Request¶
[table] Luaテーブル
Response¶
[string] JSONテキスト
json_to_table¶
response = json_util:json_to_table(request)
if response.isError then
-- エラー処理 --
print(response.statusCode)
print(response.errorMessage)
else
-- 正常処理 --
print(response.result)
end
JSONフォーマットのテキストをLuaテーブルに変換します。
Request¶
[string] JSONテキスト
Response¶
[table] Luaテーブル