jf3096/json-typescript-mapper

How to parse object with unknown properties?

LarsLiden opened this issue · 1 comments

One of properties of an object I'd like to map contains a property bag with an unknown set of properties. I'm having a hard time parsing this. The deserialize call puts an opaque "Object" in this field. Any suggestions?

Thanks!

export class MyClass
{
    @JsonProperty('type')
    public id : string;

    @JsonProperty('bag')    <-- Unknown property bag
    public bag: any; 

    public constructor(init?:Partial<LuisEntity>)
    {
        this.id = undefined;
        this.bag= undefined;
        (<any>Object).assign(this, init);
    }
}

Just removing the ref did the trick, but that doesn't help me if I need to rename the property.

    ///  @JsonProperty('bag')
    public bag: Object;