mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-01-11 22:30:41 +01:00
Fix exception when converting json array to C# code (#1301)
This commit is contained in:
@@ -96,13 +96,13 @@ internal static class CSharpFormatter
|
||||
"while"
|
||||
});
|
||||
#endregion
|
||||
|
||||
|
||||
public static object ConvertToAnonymousObjectDefinition(object jsonBody, int ind = 2)
|
||||
{
|
||||
var serializedBody = JsonConvert.SerializeObject(jsonBody);
|
||||
using var jsonReader = new JsonTextReader(new StringReader(serializedBody));
|
||||
jsonReader.DateParseHandling = DateParseHandling.None;
|
||||
var deserializedBody = JObject.Load(jsonReader);
|
||||
var deserializedBody = JToken.Load(jsonReader);
|
||||
|
||||
return ConvertJsonToAnonymousObjectDefinition(deserializedBody, ind);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user