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

how to validate json object before calling dump() #1748

Closed
nithax opened this issue Sep 12, 2019 · 2 comments
Closed

how to validate json object before calling dump() #1748

nithax opened this issue Sep 12, 2019 · 2 comments
Labels
kind: question state: stale the issue has not been updated in a while and will be closed automatically soon unless it is updated

Comments

@nithax
Copy link

nithax commented Sep 12, 2019

I'm having an issue with figuring out a method of detecting if a nlohmann:json object is valid for dump(). Currently, I've been experiencing a bug with dump() that is causing a crash with a malformed json object after parsing.

My answer to this would be to check if json::accept(json_object) would be valid before dumping to prevent a crash, but you can't do that unless you pass an input_adapter to json::accept, which is a string and not a json object.

@jaredgrubb
Copy link
Contributor

What error are you getting? That it's not holding anything? Or that some subobject has a bad type (eg, a string that's not UTF-8)?

@stale
Copy link

stale bot commented Oct 13, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the state: stale the issue has not been updated in a while and will be closed automatically soon unless it is updated label Oct 13, 2019
@stale stale bot closed this as completed Oct 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: question state: stale the issue has not been updated in a while and will be closed automatically soon unless it is updated
Projects
None yet
Development

No branches or pull requests

2 participants