>
> If you need to parse JSON with a known structure, use JsInterop to 
> describe that structure (as @JsType(isNative=true, 
> namespace=JsPackage.GLOBAL, name="*"), or name="Object" if you can't use 
> name="*"), and then either 
> com.google.gwt.core.client.JsonUtils.<JavaScriptObject>safeEval() with a 
> cast to your JsInterop interface/class, or JsInterop to call JSON.parse() 
> (as @JsMethod(namespace="JSON", name="parse") static native <T> T 
> parseJson(String json)).
> If you don't know the structure upfront, then use jsinterop-base's types 
> instead https://javadoc.io/doc/com.google.jsinterop/base/1.0.0-beta-2 
> (JsPropertyMap mostly, and the Js helper class), and the same method for 
> parsing. You might also want to have a look at elemental2-core: 
> https://javadoc.io/doc/com.google.elemental2/elemental2-core/1.0.0-beta-1 
> (which BTW defines JSONType.parse(…)), but be careful as Elemental2 is 
> entirely generated, and might change in the future as the generator evolves 
> (also, Elemental 2 might require that you use the HEAD-SNAPSHOT of GWT)
>
Thanks for that. I'll look into those solutions. 
 

> These are likely bugs, and they're unlikely to ever be fixed (unless maybe 
> someone provides the patch).
>

Would do that, but I don't know how those work :/
 

> The correct way is Json.instance(), one shouldn't ever use any "impl" 
> class.
>

That's totally correct. Didn't see it :) 

-- 
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.

Reply via email to