I'm trying to decode JSON string using JSON DECODER.
1- when I'm trying to decode this string
Code: Select all
{"power":500,"frequency":20000,"total_energy":"0.001000","duration":60}data 0 power 500
data 1 frequency 20000
data 2 total_energy 0
data 3 duration 60
No problem, I can get all the name and data
2- when I'm trying to decode this string
Code: Select all
{
	"usb_ports":	[{
			"USB_1":	{
				"power":	500,
				"duration":	5,
				"frequency":	20000,
				"total_energy":	"0.000",
				"ischeck":	true
			}
		}, {
			"USB_2":	{
				"power":	0,
				"duration":	0,
				"frequency":	0,
				"total_energy":	"0.000",
				"ischeck":	true
			}
		}, {
			"USB_3":	{
				"power":	0,
				"duration":	0,
				"frequency":	0,
				"total_energy":	"0.000",
				"ischeck":	true
			}
		}, {
			"USB_4":	{
				"power":	0,
				"duration":	0,
				"frequency":	0,
				"total_energy":	"0.000",
				"ischeck":	true
			}
		}]
}data 0 usb_ports 1
data 1 duration 5
data 2 frequency 20000
data 3 total_energy 0
data 4 ischeck 0
data 5 USB_2 0
data 6 duration 0
data 7 frequency 0
data 8 total_energy 0
data 9 ischeck 0
data 10 USB_3 0
data 11 duration 0
data 12 frequency 0
data 13 total_energy 0
data 14 ischeck 0
data 15 USB_4 0
data 16 duration 0
data 17 frequency 0
data 18 total_energy 0
data 19 ischeck 0
data 20 0
data 21 0
data 22 0
data 23 0
data 24 0
Problem, USB_1 and the 4 power data are missing
May because the decoder is not able to decode an array ?
or other ?
when I check if "power" name is present, the result 65535
Thx for your prompt reply