I know the JSON.parse()
method that will convert valid json string to Javascript object. But I have the below string that and when I tried to parse that string using JSON.parse()
it throws an error SyntaxError: Unexpected token
{ "test" :
[
{
"first_name": "Sammy",
"last_name" : "Shark",
"online" : true,
"full_name" : function() {
return this.first_name + " " + this.last_name;
}
}
]
}
now as you can see the above json string contains the function full_name()
that is why it throws an error.
Please provide any suggestion to handle this scenario.
Any suggestions would be highly appreciated !
Thanks