Using a complex JSON object - something like the following, the object is incorrectly serialized by PostJsonAsync whether using STJ or Json.Net. However, when serialized outside PostJsonAsync using default settings for Json.Net, the result is as expected.
Using latest 4pre6.
var _linkItems = new
{
Int_Key = 0,
Int_Box = 1111,
Int_Link = 2222
};
dynamic _linkWrapper = new JObject();
_linkWrapper["0"] = JObject.FromObject(_linkItems);
var _params = new
{
pageToke = "",
lotIntKey = 11,
module = 2,
lotData = new
{
Details = (string)null,
Custom = (string)null,
LinkItems = _linkWrapper,
Security = (string)null,
BIMLinks = (string)null
}
};
E.g this doesn't work:
var path = lot_Segments.Append("MyMethod");
var _req = _cookieSession.Request(path.ToArray());
var _postReq = await _req
.PostJsonAsync(_params);
However, this does:
var json = JsonConvert.SerializeObject(_params);
var content = new CapturedJsonContent(json);
var _postReq = await _req
.SendAsync(HttpMethod.Post, content);
The latter correctly sends the serialized string as
{"pageToke":"","lotIntKey":11,"module":2,"lotData":{"Details":null,"Custom":null,"LinkItems":{"0":{"Int_Key":0,"Int_Box":1111,"Int_Link":2222}},"Security":null,"BIMLinks":null}}
The first one mangles the content of linkitems into some strange set of [[[],[],[]][[]]] etc.
Using a complex JSON object - something like the following, the object is incorrectly serialized by PostJsonAsync whether using STJ or Json.Net. However, when serialized outside PostJsonAsync using default settings for Json.Net, the result is as expected.
Using latest 4pre6.
E.g this doesn't work:
However, this does:
The latter correctly sends the serialized string as
{"pageToke":"","lotIntKey":11,"module":2,"lotData":{"Details":null,"Custom":null,"LinkItems":{"0":{"Int_Key":0,"Int_Box":1111,"Int_Link":2222}},"Security":null,"BIMLinks":null}}
The first one mangles the content of linkitems into some strange set of [[[],[],[]][[]]] etc.