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

java - Static nested class instance -

c# - Bluetooth LE CanUpdate Characteristic property -

JavaScript - Replace variable from string in all occurrences -