User Tools

Site Tools


lua_cjson

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

lua_cjson [2019/01/09 14:29]
akuzmuk created
lua_cjson [2021/04/14 08:48] (current)
atolstov
Line 30: Line 30:
 value = cjson.decode(json_text) value = cjson.decode(json_text)
 -- Returns: { true, { foo = "bar" } } -- Returns: { true, { foo = "bar" } }
 +</code>
 +
 +If your task is extract from the 7bit LoRA AirGate's JSON package then use to following code
 +<code lua Extract AirGate JSON value>
 +local encoded = GetReg("encoded_json")
 +
 +local decoded_table = cjson.decode(encoded)
 +
 +for _, v in ipairs(decoded_table) do 
 +    TRACE(i .. " = " .. tostring(v)) -- show all the content of packet.
 +end
 +
 +
 +temp_int = decoded_table.temp_int -- example of extraction
 +
 +
 +
 </code> </code>