I need help to convert a JSON like this
{ "phrase": [{ "content_type": "text", "title": "blablabla 1", "payload": "blabla", "text": "" }, { "content_type": "text", "title": "blablabla 2", "payload": "blabla", "text": "" }, { "content_type": "text", "title": "blablabla 3", "payload": "blabla", "text": "" }], "ogg": "true", "custom": "true" }
To an object used in a function as "options"(or "settings", you know) like this
function(){
options = {
phrase: [
{
content_type: "text",
title: "blablabla 1",
payload: "blabla",
text: ""
},
{
content_type:"text",
title:"blablabla 2",
payload: "blabla"
},
{
content_type:"text",
title:"blablabla 3",
payload: "blabla"
}
],
ogg: true,
custom: true
}
return options;
}
Is it possibile in anyway? Thank you!
you can use this
var obj = JSON.parse(options);
It will give you object and using the dot(.) operator you can access the data inside the object