Need help to convert dynamically generated keys
Closed this issue · 2 comments
MadhavanS commented
Hi,
I need help to convert below json it has dynamic keys.
In Java, i would configure the dynamic number as Map<number, anyclass>, but how to configure it here.
I didn't see documentation similar to the below scenario.
Can you please help me
{ "values": [ { "31": { "1": { "": { "none": 21 }, "val2": { "none": 3 } } } } ] }
Thanks in advance
moshegottlieb commented
Hi there,
The whole point of the ts-json-object
framework is to strictly define the types in JSON objects deserialization.
As such, it cannot do neither dynamic typing nor polymorphism.
Once you have concluded the type of an internal object, you could use the framework to convert (and most importantly, verify it) to a typescript object.
Hope it helps!
MadhavanS commented
Thanks Mosh.