I'm messing around with building a JSON object, so I can push results from a DB query into it, Then returning the populated JSON data.. But running into a problem from the get go.
This is My current code:
//var AppenateResString = {name:"777"};
var AppenateResString = {
"DataSources": [{
"Id": "TEST",
"Rows": [
["10011", "10011 - Test Generic Project"]
],
"NewRows": [],
"DeletedRows": []
}],
"LastUpdated": ""
};
var AppenateResBody = JSON.parse(AppenateResString);
response.body = JSON.stringify(AppenateResBody);
But this is the Error I'm getting:
JavaScript Error: SyntaxError: invalid character 'o' looking for beginning of value
at
<anonymous>:21:23
--
};
var AppenateResBody = JSON.parse(AppenateResString);
^ Error!
I've narrowed it down to something is wrong with my JSON layout.. or how I'm building the JSON object.. or some basic just, "This is how you do JSON" kindof thing. But I can't figure it out.
Any ideas?
P.S. As you can see I have commented out just what I thought would be a very simple JSON object to build.. it fails the same.