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

ENH: Allow usage of custom library to serialize with to_json method. #46571

Closed
Duoquote opened this issue Mar 30, 2022 · 4 comments
Closed

ENH: Allow usage of custom library to serialize with to_json method. #46571

Duoquote opened this issue Mar 30, 2022 · 4 comments
Labels
Enhancement IO JSON read_json, to_json, json_normalize

Comments

@Duoquote
Copy link

Is your feature request related to a problem?

I was thinking about if I can pass my custom function to pandas' to_json to use some other json serializer, or maybe somehow access the dictionary that to_json method generates, turns out you can not do both.

Describe the solution you'd like

As seen here, the default json.dumps function is set hardcoded, a new argument can be added to to_json method like serializer_function. So that I can use any other library like orjson and pass it like df.to_json(serializer_function=orjson.dumps).

@Duoquote Duoquote added Enhancement Needs Triage Issue that has not been reviewed by a pandas team member labels Mar 30, 2022
@mroeschke mroeschke added IO JSON read_json, to_json, json_normalize and removed Needs Triage Issue that has not been reviewed by a pandas team member labels Jul 6, 2022
@rmhowe425
Copy link
Contributor

take

@rmhowe425
Copy link
Contributor

rmhowe425 commented Aug 12, 2023

@mroeschke @Duoquote

Should we assume that the custom function should accept any and the other parameters provided to to_json?

Would we also want to add an engine_kwargs param just like we have done for other I/O methods?
engine_kwargs could be used to pass the appropriate params to the custom serializer

@rmhowe425
Copy link
Contributor

@mroeschke @rhshadrach Do we want to close this issue in addition to the closed PR above?

@rmhowe425 rmhowe425 removed their assignment Aug 17, 2023
@mroeschke
Copy link
Member

Thanks for the issue, but it appears this hasn't gotten traction in a while so closing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement IO JSON read_json, to_json, json_normalize
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants