org.mozilla.javascript.NativeArray toJSON error

View: New views
2 Messages — Rating Filter:   Alert me  

org.mozilla.javascript.NativeArray toJSON error

by Julian Tree :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Sometimes when I have an object with arrays

I'm doing

if(!session.data.jobulousSurvey.Review.responses) session.data.jobulousSurvey.Review.responses = []

if I uneval.

uneval(session.data.jobulousSurvey.Review.responses)  // this is  end up to be org.mozilla.javascript.NativeArray

1. why is this happening?
2. this doesn't work with session.data.jobulousSurvey.Review.toJSON()

I don't really mind using a mozilla array, as long as I can use toJSON method on it.

Any recommendation or insight as why this is happening?  Is this a bug?

Julian

_______________________________________________
Helma-user mailing list
Helma-user@...
http://helma.org/mailman/listinfo/helma-user

Re: org.mozilla.javascript.NativeArray toJSON error

by Hannes Wallnoefer :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Julian,

my first guess would have been that the parent scope or prototype of the array are wrong or null, maybe because it has been serialized/deserialized or was created in another scope.

org.mozilla.javascript.NativeArray is indeed the class Rhino uses to implement javascript arrays, but you shouldn't see that when you do an uneval() or toSource().

Hannes

PS the helma mailing list has moved to http://groups.google.com/group/helma - I just haven't managed to turn the switch on the old list yet :-) So I'm cross-posting my answer to the new list.

2008/10/1 Julian Tree <julian.tree@...>
Sometimes when I have an object with arrays

I'm doing

if(!session.data.jobulousSurvey.Review.responses) session.data.jobulousSurvey.Review.responses = []

if I uneval.

uneval(session.data.jobulousSurvey.Review.responses)  // this is  end up to be org.mozilla.javascript.NativeArray

1. why is this happening?
2. this doesn't work with session.data.jobulousSurvey.Review.toJSON()

I don't really mind using a mozilla array, as long as I can use toJSON method on it.

Any recommendation or insight as why this is happening?  Is this a bug?

Julian

_______________________________________________
Helma-user mailing list
Helma-user@...
http://helma.org/mailman/listinfo/helma-user



_______________________________________________
Helma-user mailing list
Helma-user@...
http://helma.org/mailman/listinfo/helma-user