1. #1
    Sencha User
    Join Date
    Oct 2011
    Location
    São Paulo - SP
    Posts
    22
    Vote Rating
    0
    maps_tecnologia is on a distinguished road

      0  

    Default Unanswered: Java 5 + ExtJS + Rest (Complex JSON structure)

    Unanswered: Java 5 + ExtJS + Rest (Complex JSON structure)


    I was given the task to implement a REST interface to make our Java application (wicket interface) to render ExtJS components and feed their stores using JSONs.

    We have a infrastructure that can serialize a Java object into a JSON, but the problem is that it is really complex.

    It's something like this:
    Code:
    class Person {
    private String name;
    }
    Code:
    {
    "&type":"class","value":"full.qualified.name.Person","&type":"String","value":"SomeName"
    }
    The issue here is that we don't know how to follow. Either we change our infrastructure, create a new one, or try to do something in the Javascript side.

    Do you guys have and toughts about this?

  2. #2
    Ext JS Premium Member tvanzoelen's Avatar
    Join Date
    Apr 2008
    Location
    Groningen - Netherlands
    Posts
    1,114
    Answers
    83
    Vote Rating
    30
    tvanzoelen has a spectacular aura about tvanzoelen has a spectacular aura about tvanzoelen has a spectacular aura about

      0  

    Default


    Your server should deliver the json in the correct format that extjs can understand.

    Code:
    {
       persons: [ { name: 'somename' }, {name : 'someothername'} ]
    }
    I think you must use another serializer for your JSON objects. There are libraries for java available to do that. See http://json.org/java/ or http://www.json.org/ for good java libraries.

    And information like class and full.qualified.name.Person is not needed client side. So why send it to the browser? I think you should never send unwanted information, also bad for the performance.

  3. #3
    Sencha Premium Member skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,581
    Answers
    540
    Vote Rating
    317
    skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future

      0  

    Default


    Your JSON isn't valid. You have duplicate keys in your objects. It won't work correctly with any standard parser.

    ExtJS has built-in support for most common JSON formats and can be coerced into working with formats it doesn't support but you need to be using valid JSON or it has no chance.

  4. #4
    Ext JS Premium Member tvanzoelen's Avatar
    Join Date
    Apr 2008
    Location
    Groningen - Netherlands
    Posts
    1,114
    Answers
    83
    Vote Rating
    30
    tvanzoelen has a spectacular aura about tvanzoelen has a spectacular aura about tvanzoelen has a spectacular aura about

      0  

    Default


    It won't work correctly with any standard parser.
    Well, duplicate keys in the JSON were never a problem for the Ext parser.
    Would be a nice feature request.

Thread Participants: 2

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi