Matthias Burger Matthias Burger - 8 months ago 97
JSON Question

Deserializing json-schema with C#

I'm developing my own JSON-to-POCO framework.
The way I'm doing it is, that I created the class of a Json-schema that looks like this:

public class JsonSchema
public string type { get; set; }
public string title { get; set; }
public string description { get; set; }
public Dictionary<string, JsonSchema> properties { get; set; }
public JsonSchema items { get; set; }
public string id { get; set; }
public List<string> required { get; set; }
public bool ispartial = true;

and deserializing the schema to have my object(s) so I can work with it perfectly.

Everything is working fine for now, I'm getting my generated C#-file. But only if I don't add
s to my json. (Since it's much less code to add a reference in json instead of copy-paste the classes I want to support them)

What I need to do is, adding the
to my class. Problem here is, I cannot add an attribute like

public string $ref { get; set; }

to my code.

Any idea what I could do?


You may add [JsonProperty] attribute to the property you want to change the name.

public string reference { get; set; }