JSON Deserialize model fields

  1. #1

    JSON Deserialize model fields

    Hi,

    I want to deserialize my model fields. But it s not work. After deserialize model create but fields empty.


    My model:

      public class GenKullanici : BaseEntity
        {
            public Int32? Kod { get; set; }
            public string KullaniciKod { get; set; }
            public string PersonelKod { get; set; }
            public string Adi { get; set; }
            public string Soyadi { get; set; }
            public string AktifEH { get; set; }
            public DateTime? KayitTarihi { get; set; }
            public string BelediyeKod { get; set; }
            public DBActionType ActionType { get; set; }
            public int TotalCount { get; set; }
            public string BelediyeAck { get; set; }
        }

    My json data:

     [{"Kod":"3","KullaniciKod":"DENEME","PersonelKod":null,"Adi":"DENEME ADI","Soyadi":"DENEME SOYAD","AktifEH":"H","KayitTarihi":"2014-07-21T17:43:35","BelediyeKod":"3313","BelediyeAck":"Tarsus Belediyesi","ID":"ext-32-2","ActionType":2,"FieldList":"Kod|AktifEH|PersonelKod|"}]
    I try:
    list = JSON.Deserialize<List<EntitySpace.User.GenKullanici>>(data);
    Result:

    Click image for larger version. 

Name:	JsonDeserialize.jpg 
Views:	7 
Size:	63.1 KB 
ID:	21901
  2. #2
    It seems to be working. I may have missed something.

    Click image for larger version. 

Name:	sr001.png 
Views:	3 
Size:	15.5 KB 
ID:	21931

    Please post a complete (but simplified) code sample demonstrating how to reproduce the issue.

    Some more details are in our forums guidelines.
    Forum Guidelines For Posting New Topics
    More Information Required
  3. #3
    @RCN thank u! I tried like u and worked.

    I found my problem. My base class has [DataContract] attribute. When i remove [DataContract] attribute, it works.

    Thank u very much!

Similar Threads

  1. [CLOSED] json deserialize problem
    By albayrak in forum 1.x Premium Help
    Replies: 4
    Last Post: Jan 21, 2015, 3:28 PM
  2. [CLOSED] Using JSON.Serialize() and JSON.Deserialize()
    By vadym.f in forum 1.x Premium Help
    Replies: 7
    Last Post: Apr 30, 2013, 3:37 PM
  3. Replies: 6
    Last Post: Jul 12, 2012, 11:51 AM
  4. [CLOSED] JSON.Deserialize Lastes SVN
    By egodoy in forum 1.x Premium Help
    Replies: 2
    Last Post: Sep 21, 2010, 6:59 PM
  5. [CLOSED] [1.0] Ext.encode and JSON.Deserialize
    By state in forum 1.x Premium Help
    Replies: 1
    Last Post: Apr 14, 2010, 9:03 AM

Tags for this Thread

Posting Permissions