Over the last weeks I've been experimenting with Fantom, mostly very simple examples to see what it can do. So far, I like the ideas very much.
Today I tried the util::JsonOutStream functionality in util. Unfortunately, this produces invalid Json when you have (private) static or transient fields. You can also see this in the code: util::JsonOutStream.writeJsonObj (line 76) will add a comma before checking whether the field is static or transient. It should only add the comma when this check fails (not a static field and not annotated as transient).
You can also test this, using the following two classes. The test has a verifyErr around the inStream and this test is successful. When you uncomment verification part, you'll find the error.
kuipercm Sat 23 Jul 2011
Hi!
Over the last weeks I've been experimenting with Fantom, mostly very simple examples to see what it can do. So far, I like the ideas very much.
Today I tried the
util::JsonOutStream
functionality in util. Unfortunately, this produces invalid Json when you have (private) static or transient fields. You can also see this in the code: util::JsonOutStream.writeJsonObj (line 76) will add a comma before checking whether the field is static or transient. It should only add the comma when this check fails (not a static field and not annotated as transient).You can also test this, using the following two classes. The test has a
verifyErr
around the inStream and this test is successful. When you uncomment verification part, you'll find the error.-
The solution might simply be to swap line 76 and 77 in
util::JsonOutStream
. Should be checked though.Kind regards.
brian Sat 23 Jul 2011
Hi @kuipercm
Welcome to Fantom and thanks for reporting that problem. I was able to reproduce by tweaking the existing tests. I pushed a fix to hg - changeset.