On Jan 25, 7:30 pm, nlloyds <[email protected]> wrote:
> I'm using this code:
>
> <script src="http://www.json.org/json2.js"></script>
> <script runat="server" src="https://ajax.googleapis.com/ajax/libs/
> prototype/1.6.0.3/prototype.js"></script>
> <script runat="server">
> document.write(JSON.stringify([]));
> </script>
>
> Which will output null with the Prototype script tag. If that tag is
> removed, the output is [], as I had expected. I believe the JSON
> library checks for at toJSON property on objects, which doesn't
> normally exist for Array, but does after Prototype.js augments them.
>
> Any ideas?
I get "[]" with both prototype.js (1.6.0.3) and json2.js included:
<html>
<head>
<title></title>
</head>
<body>
<script src="http://www.json.org/json2.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/prototype/
1.6.0.3/prototype.js"></script>
<script type="text/javascript">
document.write(JSON.stringify([1,2,3]));
</script>
</body>
</html>
--
kangax
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Prototype & script.aculo.us" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---