Skip to content

In version 0.9.0 empty arrays are still handled incorrectly #38

@antonsmetanin

Description

@antonsmetanin
class EmptyArrayTest
{
    class Data
    {
        public int[] array;
        public string name;
    }

    class Response
    {
        public JsonData data;
    }

    string testJson = @"
    {
        ""data"":
        {
            ""array"": [],
            ""name"": ""testName""
        }
    }";

    public void Run()
    {
        var response = JsonMapper.ToObject<Response>(testJson);
        JsonMapper.ToObject<Data>(response.data.ToJson());
    }
}

As of latest commit (e16713d) this code generates a JsonException: Can't assign value 'name' (type System.String) to type System.Int32[]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions