FWIW, Elemental JSON and AutoBeans work in both environments. Note that Element JSON is still experimental and will be rewritten at some point to take advantage of JsInterop; hopefully it shouldn't impact the API much but I can't tell for sure. AutoBeans' internals will have to be rewritten for GWT 3.0 to replace the generator with an annotation processor; it shouldn't impact the API much as its much higher-level, except maybe for Splittable. Mayb other libs you'll find would be in the same situation I believe, so if you plan on using GWT 3.0 when it's out (it'll live alongside GWT 2.x for some time), take that into account.
IMO, your safest bet is to use JsInterop to represent your data, and handle your serialization behind a simple interface that you could implement with c.g.g.core.client.JsonUtils on GWT side, and with Jackson or GSON in the JVM. I haven't tried it though, this is just theory. On Thursday, February 4, 2016 at 11:22:29 PM UTC+1, Matt Campbell wrote: > > Hello: > > I want to develop an application that shares code between the browser > (via GWT), ANdroid, and iOS (via JJ2ObjC), like Inbox. My application > will access JSON-based web APIs, so it needs to be able to parse and > serialize JSON. So does anyone know if there's a Java JSON library that > works in both GWT and non-GWT environments? I see that GWT has its own > JSON package, but that won't work for the other platforms. And a quick > look at Gson and Jackson shows that they depend a lot on reflection, > which GWT doesn't support. > > Thanks, > Matt > -- You received this message because you are subscribed to the Google Groups "GWT Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/google-web-toolkit. For more options, visit https://groups.google.com/d/optout.
