nodemcu 解析 JSOn 数组
nodemcu parse JSOn array
知道如何在 NodeMCU 中解析以下类型的 json 对象数组。
"[{\"PropertyID\": \"9641\",\"DBPollCount\": 0,\"SampleTime\": \"1969-12-31T19:00:00\" },{\"PropertyID\": \"9641\",\"DBPollCount\": 0,\"SampleTime\": \"1969-12-31T19:00:00\"}]";
感谢帮助。
您是否尝试过使用 sjson module(特别是 sjson.decode()
方法)?
local jsonString = '[{\"PropertyID\": \"9641\",\"DBPollCount\": 0,\"SampleTime\": \"1969-12-31T19:00:00\"},{\"PropertyID\": \"9641\",\"DBPollCount\": 0,\"SampleTime\": \"1969-12-31T19:00:00\"}]'
local jsonObj = sjson.decode(jsonString)
应该可以解决问题。
知道如何在 NodeMCU 中解析以下类型的 json 对象数组。
"[{\"PropertyID\": \"9641\",\"DBPollCount\": 0,\"SampleTime\": \"1969-12-31T19:00:00\" },{\"PropertyID\": \"9641\",\"DBPollCount\": 0,\"SampleTime\": \"1969-12-31T19:00:00\"}]";
感谢帮助。
您是否尝试过使用 sjson module(特别是 sjson.decode()
方法)?
local jsonString = '[{\"PropertyID\": \"9641\",\"DBPollCount\": 0,\"SampleTime\": \"1969-12-31T19:00:00\"},{\"PropertyID\": \"9641\",\"DBPollCount\": 0,\"SampleTime\": \"1969-12-31T19:00:00\"}]'
local jsonObj = sjson.decode(jsonString)
应该可以解决问题。