I have my responseJson like this
const responseJson = [
{
device_id: "arena-FnVq4HTwtBg6JqqBxWBB7W",
timestamp: "2020-02-10T20:52:00.000Z",
data: "{"type": "DATA", "unitID": "arena-FnVq4HTwtBg6JqqBxWBB7W",
"version": "1.0.0",
"voltage": [130.0222, 129.9743, 129.9567, 129.9853, 130.0043, 130.0257, 130.067,
130.1005, 130.0698, 130.1056],
"frequency": [60.0005, 60.0001, 59.9984, 59.9999, 59.9992, 59.9971, 59.9977,
59.9979, 59.999, 59.9985],
"timestamp": 1581367920000,
"phaseAngle": [2.5766, 2.5769, 2.5768, 2.5761, 2.5754, 2.574, 2.5718, 2.5706,
2.569, 2.5677]}"
}
]
my data
is a string not an object. How can i parse my data to get this
const responseJson = [
{
device_id: "arena-FnVq4HTwtBg6JqqBxWBB7W",
timestamp: "2020-02-10T20:52:00.000Z",
data: {"type": "DATA", "unitID": "arena-FnVq4HTwtBg6JqqBxWBB7W",
"version": "1.0.0",
"voltage": [130.0222, 129.9743, 129.9567, 129.9853, 130.0043, 130.0257, 130.067,
130.1005, 130.0698, 130.1056],
"frequency": [60.0005, 60.0001, 59.9984, 59.9999, 59.9992, 59.9971, 59.9977,
59.9979, 59.999, 59.9985],
"timestamp": 1581367920000,
"phaseAngle": [2.5766, 2.5769, 2.5768, 2.5761, 2.5754, 2.574, 2.5718, 2.5706,
2.569, 2.5677]}
}
]
I have tried JSON.parse but no help
Here is what i get when i console.log
console.log(responseJson.data)
throws undefined
console.log(JSON.parse(responseJson.data))
throws C:\Users\aravi\Desktop\React\Reactnative\BrixonApplication_App\node_modules\react-native\Libraries\Core\ExceptionsManager.js:94 SyntaxError: Unexpected token u in JSON at position 0