toJson Stack Overflow

16 views
Skip to first unread message

Tony Zakula

unread,
Dec 15, 2010, 1:10:38 PM12/15/10
to mynajs-general
Hi all,

I am creating a JavaScript object from a set of Java objects. I am
using a Java library that parses an email. It is doing quite a bit of
recursion. It seems to be working, but when I try to do an
Myna.print(object.toJson) to take a look at what is being generated, I
get a stack overflow. Is there any easy way to increase the stack
size? Or do I basically need to try and generate the text? Or do I
need to make this a much simpler object?

Thanks,

Tony Z

Tony Zakula

unread,
Dec 15, 2010, 1:18:05 PM12/15/10
to mynajs-general
The Rhino toSource() seemed to do the trick.

Mark Porter

unread,
Dec 15, 2010, 1:59:24 PM12/15/10
to mynajs-...@googlegroups.com
toJson() should really be reserved for data obects. In particular it
cannot handle circular references which cause infinite recursion and
stack overflow. Myna.dump/printDump/textDump handle this by setting a
max depth to prevent stack overflow and are a good choice for
debugging.
----------------------------------------------------------
Mark Porter

Myna JavaScript Application Server
Easy web development with server-side JavaScript
http://www.mynajs.org

> --
> You received this message because you are subscribed to the Google Groups "MynaJS-General" group.
> To post to this group, send email to mynajs-...@googlegroups.com.
> To unsubscribe from this group, send email to mynajs-genera...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/mynajs-general?hl=en.
>
>

Reply all
Reply to author
Forward
0 new messages