I am facing an issue with parsing a JSON output that contains two strings with specific formats:
[{"device_id":"9700015","update_time":"2017-01-04 18:30:00","sensor_value":"1287.6"}]
[{"device_id":"9700016","update_time":"2016-12-31 18:30:00","sensor_value":"1113.8"}]
My goal is to combine these strings into one object. I tried using JSON.parse(data)
, but it only gives me the first string as an object, not both. How can I resolve this issue?
The desired output should look like this:
[{"device_id":"9700015","update_time":"2017-01-04 18:30:00","sensor_value":"1287.6"},
{"device_id":"9700016","update_time":"2016-12-31 18:30:00","sensor_value":"1113.8"}]