У меня есть веб-сервис, который получает строку JSON в качестве параметра.Я смог успешно отправить это только в том случае, если параметром моего веб-метода является универсальный тип 'object'.
Могу ли я сериализовать этот универсальный объект в строку или пользовательский объект?Нужно ли изменить тип параметра этого метода?Любая помощь будет потрясающей.
Вот веб-метод:
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public string StoreDataOut(object json)
{
//serialization magic
}
Это тестовый JSON, который передается этому веб-методу:
{
"uid":"1234abcd",
"application":"Application Name",
"eventName":null,
"clienttoken":"Test Client",
"version":"1.0.0",
"datetime":"1/1/2011 12:00 AM",
"data":[
{
"id":"alpha_123",
"question":"ronunciations in pre-classical times or in non-Attic dialects. For det",
"answer":"nunciations "
},
{
"id":"beta_456",
"question":"official documents such as laws an",
"answer":"or modif"
},
{
"id":"gamma_789",
"question":" maintained or modified slightly to fit Greek phonology; thus, ?",
"answer":"iation of Attic"
},
{
"id":"delta_098",
"question":"econstructed pronunciation of Attic in the late 5th an",
"answer":"unciation of "
},
{
"id":"epsilon_076",
"question":"erent stylistic variants, with the descending tail either going straight down o",
"answer":"Whole bunch"
},
{
"id":"zeta_054",
"question":"rough breathing when it begins a word. Another diacritic use",
"answer":"other dia"
}
]
}