My imp currently reads pins and sends it to the agent (as a string formed from a json-like object), which then sends it to my server.
The agent is keeping some metrics that I would like to package with the json. I’m unsure how to do this. Currently this is not working:
local incoming = http.jsondecode(response.body); //incoming["report_counter"] = report_counter; //incoming.report_counter = report_counter; response.body = http.jsonencode(incoming);
If I just used substring to remove the final } from the json object and tagged the string (also not working):
response_body = response_body.substring(0, -1) + ' "agent_metric":' + agent_metric_var + ' "}'
If I tweak it as a string then I wouldn’t be encoding/decoding json, which might actually be “quicker”, but it feels like an ugly hack.