toJson Stack Overflow

Skip to first unread message

Tony Zakula

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?


Tony Z

Tony Zakula

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

Mark Porter

Dec 15, 2010, 1:59:24 PM12/15/10
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
Mark Porter

Myna JavaScript Application Server
Easy web development with server-side JavaScript

> --
> You received this message because you are subscribed to the Google Groups "MynaJS-General" group.
> To post to this group, send email to
> To unsubscribe from this group, send email to
> For more options, visit this group at

Reply all
Reply to author
0 new messages