Closed zoechi closed 3 years ago
This seems to be working fine for me with TypedJSON 1.5.2.
@jsonObject
class Foo {
@jsonMember
bar: string = 'bar';
}
TypedJSON.parse({}, Foo); // Foo { bar: 'bar' }
TypedJSON.parse({bar: undefined}, Foo); // Foo { bar: 'bar' }
TypedJSON.parse({bar: null}, Foo); // Foo { bar: 'bar' }
Thanks for looking into it! I'll check again and reopen if I can provide a simple reproduction.
Thanks a lot for this library!
Is there a way to provide default values for properties?
does not work for me. If the value is not provided in the JSON the property is
undefined
.