1. #1
    Sencha User
    Join Date
    Oct 2010
    Location
    Kuşadası/Aydın/Turkey
    Posts
    93
    Vote Rating
    0
    TrojanMyth is on a distinguished road

      0  

    Default JsonConverter.decode remove first two char Json field value

    JsonConverter.decode remove first two char Json field value


    MyJSON String

    Code:
    {datatable:[{admin_id:1,kuladi:'trojan',sifre:'skflgorjysjurjslskfurj',adi:'Atilla İlhan',soyadi:'KARTAL',departman_id:2,lastLoginDate:'2010-10-07 11:36:24.0'}]}
    result= MyJSON;

    Code:
    Map<String,Object> userInfo = JsonConverter.decode(result);
    I used adi:'Atilla İlhan' field but returned illa İlhan.

    Best regards

    Atilla İlhan KARTAL

  2. #2
    Software Architect
    Join Date
    Sep 2007
    Posts
    13,703
    Vote Rating
    107
    sven is just really nice sven is just really nice sven is just really nice sven is just really nice

      0  

    Default


    You cannot use JsonDecoder for this.

    You need to use JsonReader, or the GWT Json api directly

  3. #3
    Sencha User
    Join Date
    Oct 2010
    Location
    Kuşadası/Aydın/Turkey
    Posts
    93
    Vote Rating
    0
    TrojanMyth is on a distinguished road

      0  

    Default


    Can u send me example for use JsonReader from json string

  4. #4

  5. #5
    Sencha User
    Join Date
    Oct 2010
    Location
    Kuşadası/Aydın/Turkey
    Posts
    93
    Vote Rating
    0
    TrojanMyth is on a distinguished road

      0  

    Default


    Code:
                 RpcProxy<String> proxy = new RpcProxy<String>() {
    
                @Override
                protected void load(Object loadConfig, AsyncCallback<String> callback) {
                    SERVICE.getSampleJsonData(callback);
                }
            };
    
             ModelType type = new ModelType();
             type.setRoot("datatable");
             type.addField("adi","adi");
             type.addField("soyadi","soyadi");
    
             JsonLoadResultReader<ModelData> reader = new JsonLoadResultReader<ModelData>(type);
             BaseListLoader<BaseListLoadResult<ModelData>> loader = new BaseListLoader<BaseListLoadResult<ModelData>>(proxy,reader);
             ListStore<ModelData> store = new ListStore<ModelData>(loader);
             loader.load();
             store.getAt(0);
    store.getAt(0); return null and Store is empty;

    I dont understand JsonConverter my json string parse and return True Mapping. But only removes first two character on value.
    Sample : adi is a json field. adi = "Atilla İlhan". JsonConverter map returned adi="illa İlhan".

    I thinking this is a bug.

  6. #6
    Software Architect
    Join Date
    Sep 2007
    Posts
    13,703
    Vote Rating
    107
    sven is just really nice sven is just really nice sven is just really nice sven is just really nice

      0  

    Default


    No its not a bug. Your format is wrong for JsonConverter as jsonconverter needs type informations.

  7. #7
    Sencha User
    Join Date
    Oct 2010
    Location
    Kuşadası/Aydın/Turkey
    Posts
    93
    Vote Rating
    0
    TrojanMyth is on a distinguished road

      0  

    Default


    Ok. All rights .

    Why dont read my Json string with reader ? Where is the problem?

  8. #8
    Software Architect
    Join Date
    Sep 2007
    Posts
    13,703
    Vote Rating
    107
    sven is just really nice sven is just really nice sven is just really nice sven is just really nice

      0  

    Default


    Is your SERVICE a remoet service?

    if so, than you cannot call anything on the store directly after you called load mehtod. Loading is async. You need to wait until it fnished loading.

  9. #9
    Sencha User
    Join Date
    Oct 2010
    Location
    Kuşadası/Aydın/Turkey
    Posts
    93
    Vote Rating
    0
    TrojanMyth is on a distinguished road

      0  

    Default


    Yes SERVICE is a remote service and return my json string data.

    Code:
             store.addStoreListener(new StoreListener<ModelData>(){
    
                @Override
                public void storeDataChanged(StoreEvent<ModelData> se) {
                    MessageBox.alert("aa", se.getStore().getModels().get(0).get("adi").toString(), null);
                }
                
             } );
    
             loader.load();
    ok its work. but how to handler service exception as GWT RPC on rpc proxy?

  10. #10
    Sencha User
    Join Date
    Oct 2010
    Location
    Kuşadası/Aydın/Turkey
    Posts
    93
    Vote Rating
    0
    TrojanMyth is on a distinguished road

      0  

    Default


    Yes SERVICE is a remote service and return my json string data.

    Code:
             store.addStoreListener(new StoreListener<ModelData>(){
    
                @Override
                public void storeDataChanged(StoreEvent<ModelData> se) {
                    MessageBox.alert("aa", se.getStore().getModels().get(0).get("adi").toString(), null);
                }
                
             } );
    
             loader.load();
    ok its work. but how to handler service exception as GWT RPC on rpc proxy?

Similar Threads

  1. JsonConverter does not decode JSON?
    By tmcguire in forum Ext GWT: Discussion
    Replies: 5
    Last Post: 11 Mar 2010, 7:52 AM
  2. Replies: 6
    Last Post: 17 Aug 2009, 12:49 PM
  3. scope used for Ext.decode (Ext.util.JSON.decode)
    By conorarmstrong in forum Ext 3.x: Help & Discussion
    Replies: 2
    Last Post: 1 Jun 2009, 12:29 PM