What is the syntax for this JSON construct?

  • Thread starter Thread starter Richard.Haggard
  • Start date Start date
R

Richard.Haggard

Guest
I'm trying to create a class to receive information from a serialized JSON string. The definition for the value is "map of arbitrary key -> value" by which I understand the key name and value are both strings but the problem is that the key name can be anything.

Here's an example of the incoming data:

"info":
{
"accept":"true",
"sharer_user_id":"rlh1234567890@gmail.com"
},

So, from the deserializer's point of view, the variable name is 'info'. It contains an array of zero or more objects that map a key to a value. In my example let's have a class named MetData. It contains an info. What is the syntax that should be associated with info?

[DataContract]
public class MetaData
{
[DataMember]
public string info; // 'string' is wrong.
// How to define map of arbitrary key —> value
}

Richard Lewis Haggard

Continue reading...
 
Back
Top