1. #1
    Ext User
    Join Date
    Feb 2010
    Posts
    2
    Vote Rating
    0
    tmcguire is on a distinguished road

      0  

    Default JsonConverter does not decode JSON?

    JsonConverter does not decode JSON?


    When calling JsonConverter.decode(s), the JSON string s does not seem to be read correctly. Specifically, JsonConverter seems to discard the first two characters of value strings:

    Code:
    {"menu":[{"heading":"one","href":"one/"}]}
    produces a Map with the expected structure but that looks like it comes from the JSON:

    Code:
    {"menu":[{"heading":"e","href":"e/"}]}
    Looking at JsonConverter.java, it seems to be expecting some kind of type tag at the beginning of the string, but that does not conform to any JSON grammar I've seen.

  2. #2
    Ext User
    Join Date
    Feb 2008
    Posts
    145
    Vote Rating
    1
    cabster is on a distinguished road

      0  

    Default


    Yes i have the same problem. Is this a bug or are we doing something wrong?
    fGwNetworks.nl Rich Internet Application development

  3. #3
    Sencha User
    Join Date
    Sep 2007
    Posts
    13,971
    Vote Rating
    132
    sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light

      0  

    Default


    JsonConverter needs an own format. It should not be used in a general case. This kind of tag is needed to support any java dataformat you might want to support.

  4. #4
    Ext User
    Join Date
    Feb 2008
    Posts
    145
    Vote Rating
    1
    cabster is on a distinguished road

      0  

    Default


    Quote Originally Posted by sven View Post
    JsonConverter needs an own format. It should not be used in a general case. This kind of tag is needed to support any java dataformat you might want to support.
    What shall i use then? I now encode my json with 2 extra spaces infont of the value;

    Code:
    result.put("message", "  " + result.get("message"));
    and decoded like this:

    Code:
    Map<String, Object> result = JsonConverter.decode(jsonStr);
    fGwNetworks.nl Rich Internet Application development

  5. #5
    Sencha User
    Join Date
    Sep 2007
    Posts
    13,971
    Vote Rating
    132
    sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light

      0  

    Default


    There is no buildin class for your usecase. GWT offers JSONObject you can use.

  6. #6
    Ext User
    Join Date
    Feb 2010
    Posts
    2
    Vote Rating
    0
    tmcguire is on a distinguished road

      0  

    Default


    Quote Originally Posted by cabster View Post
    What shall i use then?
    The standard GWT JSONParser correctly parses JSON.

Thread Participants: 2