I am using a RESTful API to get data out of a database such as firstname, lastname etc. The API gives me the data in JSON and I want to use some of it in a webpage.
For example, I want to print:
Welcome firstname lastname.
using the data from the JSON string.
How do I do this?
Assuming “myJSONtext” is well formed JSON, you can get an object representing the data with an eval:
var myObject = eval(‘(‘ + myJSONtext + ‘)’)