json-object-mapper
json-object-mapper copied to clipboard
Deserialization not working on typescript 3.1.1
Hello,
Deserialization does not work on typescript 3.1.1 and/or Angular 10. I copied, pasted and ran the SimpleRoster deserialization example on typescript 3.1.1 and/or Angular 10, but that example does not work. I created stackblitz.
https://stackblitz.com/edit/angular-ivy-ftq9ct?file=src%2Fapp%2Fapp.component.ts
I just found out that only the properties that have initial values are being deserialized. It looks like line 243 in ObjectMapper.js is the problem. Object.keys only returns properties that have values.
Hi Jonghshin,
as describe in the README, you should initialize your properties to undefined. It fixes the deserialization. Your stackblitz with the fix https://stackblitz.com/edit/angular-ivy-pknkua?file=src%2Fapp%2Fapp.component.ts