I tried JSON.parse
but didn't work. Please tell me how I can parse this data.
[
{
"value": { "top": 343,"left": 397,"width": 283,"height": 283} ,
"main": {"sm": 0.263,"sd": 5,"fs": 22,"gs": 15}
}
]
My goal is reach the objects with obj.x like:
obj = JSON.parse(data);
$( "#dialog_title_span" ).text(obj.value.top + obj.value.left);
Edit: Json Corrected.
This is not a jSON. It is just an array of objects. You can traverse through loop. Like data[0].value.top gives you 343.
JSON is
Data is in name/value pairs, Data is separated by commas, Curly braces hold objects,
like:-
var value = '{ "name":"John", "age":30, "city":"New York"}'
This is a JSON. you can parse it using JSON.parse
a = JSON.parse(value)
Then you can acces name like:-
a.name
For more refernce you can study here
Firebase Cloud Functions: PubSub, "res.on is not a function"
TypeError: Cannot read properties of undefined (reading 'createMessageComponentCollector')
I have 2 datatablesI want to add a row to another table and remove from the other table
I have a started foreground serviceI've taken care to return START_STICKY from onStartCommand
So I wrote this very basic code in python,I used repltit to write and test this
I am posting JSON originally via terminal, which looks like this