5

I run simple deserialization into own type Event with :

JSON.Deserialize<Event>(text);

with exception:

An exception of type 'Jil.DeserializationException' occurred in Jil.dll but was not handled in user code.
Additional information: Expected character: '\'

Newtonsoft's JSON deserialization works well on the same json, also JSONLint confirmed JSON is valid. Any clues here ? I tried passing in string, as well as using using(StringReader) as is suggested on JIL's github page.

frno
  • 1,064
  • 11
  • 24

1 Answers1

8

Without seeing the JSON-String, you try to deserialize i am not sure about this, but eventually the deserializer expects the date(time) that you're trying to deserialize to be in another format (I guess you're trying to deserialize a datetime-field).

It seems that JIL assumes, that datetimes are delivered as 'NewtosoftDateTime', but you are delivering another format. See https://github.com/kevin-montrose/Jil/blob/master/Jil/Deserialize/InlineDeserializer.cs#L667 for detailed infos, how jil assumes your date is formatted.

You can change the expected formatting via Options. See more here: https://github.com/kevin-montrose/Jil/blob/master/Jil/Options.cs

Marvin
  • 329
  • 1
  • 6
  • you are correct, date was the issue here, choosing correct option solved the problem – frno Apr 10 '15 at 12:09