c# - How to serialize JSON that uses keywords for names? -


i need make json string using json.net:

{   "description": "the description",   "public": true,   "files": {     "index.html": {       "content": "some value"     }   } } 

so how can that?

i tried creating class it, don't know how create field name "public" because public c# keyword.

the property name want, if want value map it, need add jsonproperty attribute indicating name of property.

public class myobject {     public string description { get; set; }     [jsonproperty("public")]     public bool ispublic { get; set; }     public dictionary<string, jobject> files { get; set; } } 

Comments

Popular posts from this blog

matlab - error with cyclic autocorrelation function -

django - (fields.E300) Field defines a relation with model 'AbstractEmailUser' which is either not installed, or is abstract -

c# - What is a good .Net RefEdit control to use with ExcelDna? -