0

I figure this may be an unconventional way of creating a JSON string. But, I really need to just be able to make it right in "Sequel Pro" like this

enter image description here

I want to be able to just edit it right there like that. But when I receive the string on the client end, then try to use as3 JSON.parse function on it, it gets an error..."SyntaxError: Error #1132: Invalid JSON parse input."

 private function storyTextCallBack(r:Object):void
            {

                        //storyText is an 'Object'
                storyText = JSON.parse(r.text);

            }

But this is how my client is actually getting it, and it's what I think is breaking the JSON.parse function.....

 [\n\t{\n\t\ttext: "hello this is some json test stuff",\n\t\tduration: "5000"\n\t},\n\t{\n\t\ttext: "this is the second line in that json object thing",\n\t\tduration: "3000"\n\t},\n\t{\n\t\ttext: "this is the third and final line in that json object thing",\n\t\tduration: "8000"\n\t}\n]

anyone have any ideas how I can fix this?

brybam
  • 5,009
  • 12
  • 51
  • 93

1 Answers1

3

The object names in your JSON need to be inside quotes:

"text":"example text"

You can check if you have a valid JSON object with this parser: http://json.parser.online.fr

David Mear
  • 2,254
  • 2
  • 13
  • 21
  • wow, can't believe i overlooked that. I got distracted thinking it was adding extra characters and things. Great, easily fixed. Thanks again! – brybam Jan 22 '13 at 23:19