tags:

views:

9

answers:

0

Is there a way to convince DataContractJsonSerializer to parse JSON with arbitrary key names? As an example, consider the following JSON emitted from a web service:

{
  "1": {
    "First":"John",
    "Last":"Doe"
   },
  "2": {
    "First":"Jane",
    "Last":"Doe"
   }
}

Obviously, it's easy to get the "inside" objects. I just apply the [DataMember] attribute to the First and Last properties. But can the serializer parse that id (i.e. "1" or "2") into an Id property?