I’m retrieving an array of objects from a hidden html input field. The string I’m getting is:
"{"id":"1234","name":"john smith","email":"jsmith@blah.com"},{"id":"4431","name":"marry doe","email":"mdoe@blah.com"}"
Now I need to pass this as an array of objects again. How do I convert this string into array of objects?
This executes the string as code, which is why we need to add the [] to make it an object. This is also one of the few legitimate uses for eval as its the fastest and easiest way. 😀