Ho un oggetto x contenente 4 stringhe "principali": code, message, headers e body
codice HTML:
{ "code": 200,
"message": "OK",
"headers": {
"Connection": "close",
"Content-Length": "124",
"Content-Type": "application/json"
,"Server": "ShellyHTTP/1.0.0"
},
"body": {\"id\":0,\"current\":1.565,\"voltage\":233.1,\"act_power\":263.9,\"aprt_power\":366.3,\"pf\":0.77, \"freq\":50.0,\"calibration\":\"factory\"}"
}
, aggiungendo ad x una delle "voci" principali, ad esempio x.body ottengo la stringa
codice:
{"id":0,"current":1.705,"voltage":235.8,"act_power":335.6,"aprt_power":403.6,"pf":0.88, "freq":50.0,"calibration":"factory"}
da cui vorrei ricavare il valore numerico di act_power, come posso fare?
Ps Ho già provato x.body.act_power, x.body.{"act_power"}, x.body."{act_power"}, x.body.{act_power} ma nulla...