Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: JsonConverter.decode remove first two char Json field value

  1. #1
    Sencha User
    Join Date
    Oct 2010
    Location
    Ku?adas?/Ayd?n/Turkey
    Posts
    94
    Vote Rating
    0
      0  

    Default 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
    Sencha Premium Member
    Join Date
    Sep 2007
    Posts
    13,976
    Vote Rating
    131
      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
    94
    Vote Rating
    0
      0  

    Default

    Can u send me example for use JsonReader from json string

  4. #4
    Sencha Premium Member
    Join Date
    Sep 2007
    Posts
    13,976
    Vote Rating
    131
      0  

  5. #5
    Sencha User
    Join Date
    Oct 2010
    Location
    Ku?adas?/Ayd?n/Turkey
    Posts
    94
    Vote Rating
    0
      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
    Sencha Premium Member
    Join Date
    Sep 2007
    Posts
    13,976
    Vote Rating
    131
      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
    94
    Vote Rating
    0
      0  

    Default

    Ok. All rights .

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

  8. #8
    Sencha Premium Member
    Join Date
    Sep 2007
    Posts
    13,976
    Vote Rating
    131
      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
    94
    Vote Rating
    0
      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
    94
    Vote Rating
    0
      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?

Page 1 of 2 12 LastLast

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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •