Rewriting this stuff isn't hard but is more of a maintenance issue.  anyway it looks like it easier to simply rewrite the code that breaks because of json.js with the addition of writing nastygrams to tell other devs how to do proper JS iteration :)

On 10/31/06, Ryan Gahl <[EMAIL PROTECTED]> wrote:
If MochiKit has your desired behavior, why not pull theirs in to your project, or port theirs to the prototype model?

json.js is quite good, and not at all very large. If you don't like it's mucking with the prototypes as it does, why not just rewrite its functions as static functions, where the first argument would be the instance you want to serialize? That would take but 20 minutes or so of work tops.

On 10/31/06, Fred <[EMAIL PROTECTED] > wrote:


Carl Shimer wrote:
> Hi,
>
> Is there a JSON serializer for prototype or is anyone working on one?  I am
> looking for something equivalent to MochiKit's JSON support.  The serializer
> from json.org mucks with the prototype of object, array, etc so trips up
> anyone who writes code using the native iteration support, e.g for (var foo
> in bar).

You could ignore any property called "toJSONString", or more
generically any property whose value is a function.  json.js messes
with all basic _javascript_ objects - Array, Boolean, Date, Number,
Object and String.

Prototype 1.4 messes with Object and Array, Prototype 1.5 messes with
Array, so your problems don't end with fixing json.js.


--
Fred







--
Ryan Gahl
Application Development Consultant
Athena Group, Inc.
Inquire: 1-920-955-1457
Blog: http://www.someElement.com




--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" 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/rubyonrails-spinoffs
-~----------~----~----~----~------~----~------~--~---

Reply via email to