Hi Community,
We have this requirement, where we need to receive a complex json object and then store it in our database as a string, without using DataContracts.
To achieve this we though about using the "object" type and then serialize it into a string using JsonConvert.SerializeObject method.
[OperationContract]
[WebInvoke(Method = "POST", UriTemplate = "/store", RequestFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Bare, ResponseFormat = WebMessageFormat.Json)]
public Response AddStore(object store) {
Response response = new Response();
response.MessageId = "1";
response.Description = "Store Inserted!";
string storeString = JsonConvert.SerializeObject(store, Formatting.Indented);
var ins = new Insert(UserConnection)
.Into("ImdStagingInArticle")
.Set("ImdMessage", Column.Parameter(storeString))
.Set("ImdStateId", Column.Parameter(new Guid("2d1dee23-058b-45fe-95a0-2e1612fc4261")));
ins.Execute();
return response;
}
However, the string is always empty.
Since the json is to complex, the serializer cannot process the entire json data.
We also tried to use WebOperationContext, but that doesn't work.
Can someone help us solve this issue? Did anyone have something similar?
Thank you.