Re: JSON.stringify on Java object

2013-09-16 Thread Attila Szegedi
I hope it's an obvious mistake, but I meant to say "acyclic non-tree graphs" when I said "acyclic non-graph trees"… :-[ Attila. On Sep 17, 2013, at 8:14 AM, Attila Szegedi wrote: > Ah, that's a common pitfall :-) So common in fact, that I'm devoting it few > slides in my JavaOne talk next wee

Re: JSON.stringify on Java object

2013-09-16 Thread Attila Szegedi
Ah, that's a common pitfall :-) So common in fact, that I'm devoting it few slides in my JavaOne talk next week. The gist of it is that JSON.stringify… 1. doesn't stringify POJOs, 2. can't be extended by Nashorn to stringify POJOs, 3. but there's help, as long as you don't mind writing some code

Re: JSON.stringify on Java object

2013-09-16 Thread Viktor Gamov
Hi Jim, I thought so. I have utility method like this (basically use jackson from js script): @Test public void convertToJson() throws ScriptException, NoSuchMethodException, FileNotFoundException { Person person = new Person(); person.setFirstName("Vik"); person.setLastName("Gamov"

Re: JSON.stringify on Java object

2013-09-16 Thread Jim Laskey (Oracle)
Viktor, We will not likely support stringify of Java Objects. It's hard to justify doing stringify without parse and then getting into the whole serialization security nightmare that plagued Rhino. If you RFE this feature it would be very restricted. I'm not sure if you can accomplish the sa

JSON.stringify on Java object

2013-09-16 Thread Viktor Gamov
Hello Nashorn team, I have a question regarding conversion java object to json using JSON.stringify. Is it possible? Here is my test method @Test public void convertToJson() throws ScriptException, NoSuchMethodException { Person person = new Person(); person.setFirstName("Vik"); pers