I also tried to convert back to the original object:
@JsType(isNative=true, namespace=GLOBAL)
public class JSON {
public native static String stringify(Object obj);
public native static Object parse(String obj);
}
and then:
//....
Record converted = (Record) JSON.parse(json);
and it works just fine. why would we need something like gwt-jackson
anymore?
Le vendredi 19 août 2016 12:05:32 UTC+2, zakaria amine a écrit :
>
> It works. I prefer your solution.
>
> Le vendredi 19 août 2016 11:51:35 UTC+2, Jens a écrit :
>>
>>
>>
>> Am Freitag, 19. August 2016 11:43:12 UTC+2 schrieb zakaria amine:
>>>
>>> I have tried something like:
>>>
>>> @JsType(namespace=GLOBAL)
>>> public class Record {
>>> String id;
>>> String date;
>>> String data;
>>> public Record() {
>>> }
>>> }
>>>
>>
>> By default @JsType property "isNative" is false, so your Record class is
>> a non-native class that might get exported to JS if you use
>> -generateJsInteropExports during compilation. If you don't use that flag
>> the @JsType is treated as a normal class I guess.
>>
>> You should use @JsType(isNative=true, namespace=GLOBAL, name="Object") so
>> that your Record class becomes a plain JavaScript object
>>
>> -- J.
>>
>
--
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.