The string you are returning is not valid JSON. The names in the objects needs to be quoted and the whole string needs to be put in { … }
to form an object. JSON also cannot contain something like new Date()
. JSON is just a small subset of JavaScript that has only strings, numbers, objects, arrays, true
, false
and null
.
See the JSON grammar for more information.