public class Data
{
public Field DataField { set; get; }
public object Value { set; get; }
}
public enum Field
{
Name,
Age,
LastVisit
}
...
..
.
Data[] data = new Data[3];
data[0] = new Data { DataField = Field.Name, Value = "Aharon K." };
data[1] = new Data { DataField = Field.Age, Value = 29 };
data[2] = new Data { DataField = Field.LastVisit, Value = DateTime.Now };
I have a WCF Rest function that supose to accept Json request format
public class Data
{
public Field DataField { set; get; }
public object Value { set; get; }
}
public enum Field
{
Name,
Age,
LastVisit
}
...
..
.
Data[] data = new Data[3];
data[0] = new Data { DataField = Field.Name, Value = "Aharon K." };
data[1] = new Data { DataField = Field.Age, Value = 29 };
data[2] = new Data { DataField = Field.LastVisit, Value = DateTime.Now };
I have a WCF Rest function that supose to accept Json request format
void SetData(int clientId, Data[] client);
How does my Json request supose to look like?
Thanks in advanced
{
"Root": "OK"
"Data":[{"Name":"Aharon K.",
"Age":"25"
"LastVisit":8/9/2011
}]
your json tags will look somewhat like this. Please go through json notations so that you could understand what i have written
If my ANSWER helps you in solving your problem MARK IT AS ANSWER
Marked as answer by peter pi - msft on Aug 15, 2011 01:14 AM
eddyuk
Member
40 Points
50 Posts
wcf rest post complex object in json format
Aug 08, 2011 02:53 PM|LINK
Hi
This is the structure i have:
public class Data { public Field DataField { set; get; } public object Value { set; get; } } public enum Field { Name, Age, LastVisit } ... .. . Data[] data = new Data[3]; data[0] = new Data { DataField = Field.Name, Value = "Aharon K." }; data[1] = new Data { DataField = Field.Age, Value = 29 }; data[2] = new Data { DataField = Field.LastVisit, Value = DateTime.Now };I have a WCF Rest function that supose to accept Json request format
void SetData(int clientId, Data[] client);
How does my Json request supose to look like?
Thanks in advanced
codeseed
Member
529 Points
146 Posts
Re: wcf rest post complex object in json format
Aug 09, 2011 11:24 AM|LINK
{
"Root": "OK"
"Data":[{"Name":"Aharon K.",
"Age":"25"
"LastVisit":8/9/2011
}]
your json tags will look somewhat like this. Please go through json notations so that you could understand what i have written