Thanks Thomas, I'm excited to see where this will lead.

Can you talk a little more about plans POJO support, as none of the three 
existing options have any? Would you envision a wrapping tool that looks 
like AutoBean/gwt-jackson, and where on that continuum are you thinking 
(autobean is as late as possible, and generic enough to handle xml or other 
underlying data formats, gwt-jackson parses then copies all json tree nodes 
directly to bean values)? I also know there have been some experiments 
around passing a reviver func to JSON.parse that could be interesting here. 
Any thoughts on handling collections, whether to go with java.util, or try 
for something shared js/jvm and only used within this library?

As a replacement for elemental.json or c.g.g.json, I would personally 
imagine only the json node tree support. I'm aware that work is ongoing 
already to update gwt-jackson to move to APT, and am considering trying 
AutoBeans myself, mostly because i find it so handy when I want to write 
strongly typed java around plain json.

My only thought on adapter vs starting with a specific jre parser is that 
there is a lot of flexibility/depth already in this project - perhaps just 
keep the internals as private as possible, and leave room for such adapters 
in vers 2?

On Monday, December 11, 2017 at 6:25:04 AM UTC-6, Thomas Broyer wrote:
>
> Hi all,
>
> Following up on 
> https://github.com/gwtproject/gwt/issues/9484#issuecomment-277216304, 
> I've been toying around to build a new JSON library for GWT.
> Note that my goal is to have a lightweight library that could be used both 
> on the client-side with GWT (and then j2cl), and on the server-side or in 
> any JVM; and "mapping" to/from POJOs is (currently) out of scope.
>
> What do you think would be the best API?
>
>
>    - Same as com.google.gwt.json.
>    This API is IMO verbose, and is based on wrapper objects that add 
>    runtime overhead.
>    - Same as elemental.json, except for JsonNull which goes away 
>    (represented by a Java 'null' and interchangeable with 'undefined').
>    Lighter-weight, both in terms of API verbosity and runtime overhead 
>    (no wrapper object).
>    Based on type coercion (you can ask every JsonValue to be returned as 
>    a boolean, double, or String, and value will be coerced accordingly).
>    elemental.json "JRE" types are also usable on client-side, and can be 
>    transported through GWT-RPC; I believe this is an aspect that we cannot 
>    preserve.
>    - Similar to jsinterop-base's Any, JsPropertyMap and JsArrayLike (for 
>    JsonValue, JsonObject and JsonArray respectively), and using Java String 
>    and primitives for other value types; and probably with the addition of a 
>    JsonType enum (or isXxx methods) on Any/JsonValue to be able to tell value 
>    types apart before you call the (throwing) asXxx methods.
>    This is actually similar to elemental.json but without the 
>    JsonBoolean, JsonNumber, and JsonString types; and it throws rather than 
>    coercing values.
>    This could even go farther and directly use JsonValue[] instead of 
>    JsonArray.
>    - Something else?
>
> One question also is whether this should be used for consuming JSON 
> mostly, or also for creating JSON (you'd generally use POJOs and serialize 
> them to JSON I believe, but there may be cases where you want to create a 
> dynamic structure that you cannot easily represent as a tree of POJOs), 
> and/or "updating/modifying JSON" (parse, update, stringify).
>
> Fwiw, this would also be a good opportunity to shape how a cross-platform 
> library would be developed in terms of project layout and tooling (in both 
> Gradle and Maven).
>
> Wrt the JVM/server-side support, what JSON parsing library should be used? 
> I was heading towards the lightweight Moshi from Square, but I believe 
> there could possibly be several "adapters" for Moshi, GSON, Jackson, etc. 
> (and even org.json's JsonTokenizer/JsonStringer)
>

-- 
You received this message because you are subscribed to the Google Groups "GWT 
Contributors" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-web-toolkit-contributors/3c1d1f76-6da7-4a5f-bda0-7ddcbe2eaddd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to