Note that there are some explanatory texts on larger screens.

plurals
  1. POJson Mapping and serializing in C#
    primarykey
    data
    text
    <p>i'm trying to map a json string similar to this in c# to an object. my purpose is to send it to my cilent side (it's a jquery application) I was wondering whether i'm doing right ?</p> <pre><code>{"tasks":[ { "id":-1, "name":"Gantt editor", "code":"", "level":0, "status":"STATUS_ACTIVE", "start":1372608000000, "duration":21, "end":1375113599999, "startIsMilestone":true, "endIsMilestone":false, "collapsed":false, "assigs":[] }, { "id":"tmp_fk1372575559620", "name":"release", "code":"", "level":1, "status":"STATUS_ACTIVE", "start":1372608000000, "duration":1, "end":1372694399999, "startIsMilestone":false, "endIsMilestone":false, "collapsed":false, "assigs":[] } ], "selectedRow":8, "deletedTaskIds":[], "resources": [ { "id":"tmp_1", "name":"Resource 1" } ], "roles":[ { "id":"tmp_1", "name":"Project Manager" } ], "canWrite":true, "canWriteOnParent":true } </code></pre> <p>and this is how i mapped it </p> <pre><code>public class Attributes { public List&lt;Task&gt; _Task { get; set; } public List&lt;Resource&gt; _Resource { get; set; } public List&lt;Role&gt; _Role { get; set; } public bool _canWrite { get; set; } //"canWrite":true, public bool _canWriteOnParent { get; set; } //"canWriteOnParent":true, public bool _selectedRow { get; set; } //"selectedRow":0, public string [] _DeletedTaskIds { get; set; } //"deletedTaskIds":[], } public class Task { private string _id { get; set; } private string _name { get; set; } private string _code { get; set; } private int _level { get; set; } private string _status { get; set; } private int _start { get; set; } //“start”:1348696800000, private int _duration { get; set; } //“duration”:10, private int _end { get; set; } //“end”:1349906399999, private bool _startIsMilestone { get; set; } //“startIsMilestone”:false, private bool _endIsMilestone { get; set; } //“endIsMilestone”:false, public List&lt;Assign&gt; _assigns { get; set; } //“assigs”:[…], private string _depends { get; set; } //“depends”:”7:3,8″, private string _description { get; set; } //“description”:”Approval of testing”, private int _progress { get; set; } //“progress”:20 } public class Assign { private string _resourceId { get; set; } //“resourceId”:”tmp_1″, private string _id { get; set; } //“id”:”tmp_1345560373990″, private string _roleId { get; set; } //“roleId”:”tmp_1″, private string _effort { get; set; } //“effort”:36000000 } public class Resource { private string _id { get; set; } //“id”:”tmp_1″, private string _name { get; set; } //“name”:”Resource 1″ } public class Role { private string _id { get; set; } //“id”:”tmp_1″, private string _name { get; set; } //“name”:”Project Manager” } </code></pre> <p>if I'm doing it right, how can I serialize it into an object and send in order to send it to client side ? </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload