That's not JSON code.

* JSON doesn't use a () wrapper around the whole thing.

* JSON requires all property names to be double-quoted, e.g. "billed":null.

* JSON does not allow executable code such as "new Date(...)". You can use
the plain date strings instead and execute the "new Date" on them in the
code that processes the JSON.

I assume that the line breaks in the description strings in your original
post are not present in the actual code, is that correct?

Now, these problems may not be the cause of the intermittent errors - jQuery
doesn't use a strict JSON parser - but it's worth knowing what makes valid
JSON in any case.

-Mike

> From: sgrover
> 
> I think my generated json code is messed up...
>
> (
>    [
>      {
>        id: "124",
>        organization: "XYZ Corp",
>        start: new Date("2007-09-30 13:30:00"),
>        end: new Date("2007-09-30 19:00:00"),
>        duration: 5.5,
>        worktype: "Programming",
>        project: "Projext X",
>        description: "Scans.  Fixed...talk with Norm.",
>        billed: null
>      },
>      {
>        ...
>      }
>    ]
> )

Reply via email to