On 8 avr, 21:44, lineman78 <[email protected]> wrote:
> Hello all,
>
> I am currently working with using JAX-RS to retrieve data from my
> server in JSON format, and the default marshaller adds the '@' symbol
> to the beginning of variable names for attributes.  I am using the
> method of casting the JSON to a JavaScriptObject using the eval(json)
> function.  The problem is that the object looks like this:
>
> {
>   '@firstName':'Ted'
>
> }
>
> and I am using the native method to get the object:
>
> public final native String getFirstName()/*-{ return
> th...@firstname; }-*/;
>
> which of course gives an error because it is expecting a package
> name:variable after that @ symbol.  My question is if there is a way
> to escape the character so that the JSNI parser will ignore it and
> pass the literal, because we are having some issues getting JAX-RS to
> use a different JSON format.


th...@firstname isn't legal JavaScript either (not even talking about
JSNI here), except if you use E4X (which GWT doesn't support, and only
a few browsers do (maybe only Firefox?)).
The proper syntax would be this["@firstName"], and this should solve
your JSNI/GWTCompiler issue at the same time.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to