You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Looks like Jil throws a DeserializationException when encountering a key in a child which should be empty. Example:
using System;
using Jil;
using Newtonsoft.Json;
namespace JsonTests
{
class Response
{
public int id { get; set; }
public Foo foo { get; set; }
}
class Foo { /* nothing here .. yet */ }
class Program
{
static void Main(string[] args)
{
const string jsonString = "{ \"id\" : 17, \"foo\" : { \"bar\" : 17} }";
var resultJsonNet = JsonConvert.DeserializeObject<Response>(jsonString); /* ok */
Console.WriteLine(resultJsonNet.id);
var resultJil = JSON.Deserialize<Response>(jsonString); /* throws */
Console.WriteLine(resultJil.id);
}
}
}
Can easily be mitigated by removing the empty Foo on the parent. But IMO worth making it a bit more robust if feasible without perf impact. It's a fairly typical dev workflow to incrementally build out data model, starting with empty classes. So those exceptions can hurt productivity a bit when it's not clear where they're coming from.
The text was updated successfully, but these errors were encountered:
Looks like Jil throws a DeserializationException when encountering a key in a child which should be empty. Example:
Can easily be mitigated by removing the empty Foo on the parent. But IMO worth making it a bit more robust if feasible without perf impact. It's a fairly typical dev workflow to incrementally build out data model, starting with empty classes. So those exceptions can hurt productivity a bit when it's not clear where they're coming from.
The text was updated successfully, but these errors were encountered: