Parsing field name with a colon in JSON

How can we parse if json fields contains a colon(:)? Like this:

  "dc:creator":"Jordan, Micheal",
  "element:publicationName":"Applied Ergonomics",

In fact I wonder how to do this with a library like restsharp, for mapping?


Using Json.Net

string json = @"{
            ""dc:creator"":""Jordan, Micheal"",
            ""element:publicationName"":""Applied Ergonomics"",

var pub = JsonConvert.DeserializeObject<Publication>(json);

public class Publication
    public string creator { set; get; }
    public string publicationName { set; get; }
    public string issn { set; get; }



If you use DataContractJsonSerializer, DataMemberAttribute has property Name which can be used to override default name. This means that when you deserialize json value of property dc:creator is assigned to Publication::Creator property and on the contrary when you serialize C# object.

For example:

public class Publication
    public string Creator { set; get; }
    public string PublicationName { set; get; }
    public string Issn { set; get; }

If you choose to use Json.Net, @L.B's answer is the way to go.

Need Your Help

How do I get jQuery to load when clicking a button?

javascript jquery fancybox fancybox-2

How do i get jQuery to load once I click on the button. So far it loads when the page is loading. I want it to load after clicking the button! i tried a lot of things and they haven't worked so far

UISegmentedControl segment size touch detect

ios touch uisegmentedcontrol

I have created a segmented controller which has different sized segments.