Skip to content

Unable to decode Dictionary<string, object> #157

@goncalo-oliveira

Description

@goncalo-oliveira

Consider the following structure

public class Person
{
    public string Name { get; set; }
    public Dictionary<string, object> Metadata { get; set; }
}

The encoder doesn't seem to have an issue and serializes the dictionary correctly; here's the encoded value ToString().

ObjectV(name: StringV(Japanfy),metadata: ObjectV(comm.status: StringV(connected),comm.satellites: LongV(8)))

However, the decoder doesn't behave well with this and doesn't decode the values of the dictionary. It just creates an empty object for each.

{"Name":"Japanfy","Metadata":{"comm.status":{},"comm.satellites":{}}}

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