Skip to content

Cannot read empty or singleton arrays with JSON.arrayOfFrom #40

@gpiancastelli

Description

@gpiancastelli

When I write:

JSON.std.with(JSON.Feature.READ_JSON_ARRAYS_AS_JAVA_ARRAYS)
        .arrayOfFrom(MyClass.class, stringContent);

my application crashes with a ClassCastException:

java.lang.ClassCastException: java.lang.Object[] cannot be cast to com.example.MyClass[]

Everything works when the array carries more than one element. I have also tested with empty arrays, and I got the same exception. I am somehow reminded of #27 where arrays featured a similarly bugged behaviour, except it involved casting an ArrayList.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions