Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parent data in custom converter #144

Open
andreas-aeschlimann opened this issue Jun 1, 2020 · 2 comments
Open

Parent data in custom converter #144

andreas-aeschlimann opened this issue Jun 1, 2020 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@andreas-aeschlimann
Copy link
Member

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.

@andreas-aeschlimann andreas-aeschlimann self-assigned this Jun 1, 2020
@andreas-aeschlimann andreas-aeschlimann added the enhancement New feature or request label Jun 1, 2020
@srn271
Copy link

srn271 commented Oct 7, 2022

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.

@andreas-aeschlimann
Copy link
Member Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants