Prototype adds Array.prototype.toJSON() that breaks JSON.stringify

This issue is archived. You can view it, but you can't modify it. Learn more

XMLWordPrintable

      Inside Jenkins, JSON.stringify([1,2]) returns ""[1,2]"" (string that has " as the first char), instead of "[1,2]" (string that has '[' as the first char)

      This is because JSON.stringify consults toJSON methods on objects, and Prototype adds toJSON method on Array.

      I'm not sure how to resolve this aside from overriding JSON.stringify() with Prototype's Object.toJSON.

            Assignee:
            Unassigned
            Reporter:
            Kohsuke Kawaguchi
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Archived: