Skip to content

[Deserialization] Exception: Expected digit #348

@Saibamen

Description

@Saibamen

This JSON can be deserialized by Newtonsoft.Json without any problems.

JSON:

{
   "MyString":"testString",
   "MyInt":5,
   "MyIntButStringInJson":"234"
}

Class:

public class TestJil
{
    public string MyString { get; set; }
    public int MyInt { get; set; }
    public int MyIntButStringInJson { get; set; }
}

Deserialization code:

var testJson = "{\r\n   \"MyString\":\"testString\",\r\n   \"MyInt\":5,\r\n   \"MyIntButStringInJson\":\"234\"\r\n}";

using (var input = new StringReader(testJson))
{
    var dupaTam = JSON.Deserialize<TestJil>(input);
}

Exception

Message = "Expected digit"

SnippetAfterError = "234\"\r\n}"

StackTrace:

at Jil.Deserialize.Methods._ReadInt32(TextReader reader)
at Jil.JSON.Deserialize[T](TextReader reader, Options options)

Jil version: 2.17.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions