On 5 mai, 06:43, Brijesh <[email protected]> wrote:
> Hi,
>
> I am new to GWT and struggling to get my json parsed on GWT client, I
> have a nested JSON which i need to parse through overlay types. Please
> suggest me how to parse it.
>
> JSON is like
>
>  [{"BG1":[{ "BA1":[{"DESK1":["IG1", "IG2"],"DESK2":["IG1",
> "IG2"],"DESK2":["IG1", "IG2"]}], "BA2":[{"DESK1":["IG1",
> "IG2"],"DESK2":["IG1", "IG2"],"DESK3":["IG1", "IG2"]}] }], "BG2":
> [{ "BA1":[{"DESK1":["IG1", "IG2"],"DESK2":["IG1", "IG2"],"DESK2":
> ["IG1", "IG2"]}], "BA2":[{"DESK1":["IG1", "IG2"],"DESK2":["IG1",
> "IG2"],"DESK3":["IG1", "IG2"]}] }]}]
>
> or else suggest me any other method by which i can parse such kind of
> nested json at GWT client side.

Works but builds a JSONArray instance that's not really useful:
JsArray<MyOverlay> arr = JSONParser.parse(jsonString).isArray
().getJavaScriptObject();

or:

public static native JavaScriptObject parseJSON(String jsonString) /*-
{
    return eval("(" + jsonString + ")");
}-*/;

then:
jsArray<MyOverlay> arr = parseJSON(jsonString);

(this could be improved to use native JSON support in IE8, FF3.5, etc.)
--~--~---------~--~----~------------~-------~--~----~
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