json2typescript
json2typescript copied to clipboard
Parent data in custom converter
As of now, the JsonCustomConvert interface has the methods serialize(data: T): any and deserialize(data: any): T.
In some cases, the (de-)serialization might be dependent on the parent's object values. We could add an optional parameter parentData?: any in both methods that contains the parent data (object) if it exists, undefined otherwise.
This is exactly the feature I currently need and that's why I came across this issue.
Would be great if a context could be passed. Then this could be extended in the future with other useful data.
A reference to the jsonConvert instance would be also nice. In some use cases I needed access to it in order to manually (de)serialize something.