Skip to content

Moshi incorrectly deserializes an integer into a double-value #192

@sqrt-1764

Description

@sqrt-1764

I am deserializing a map with name/value pairs where the values can have any value-type. So no class with members of a defined type can be given to deserialize into.

I can deserialize into a Map<String,Object> (the only solution), but then all numbers are deserialized into doubles. The underlying problem is that integers are wrongly convertet to doubles.

A simple call to

moshi.adapter(Object.class).fromJson("1234")

demonstrates this. Here a double is returned, whereas the argument describes an integer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions