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

Add a function that checks for valid json in a C++ string #3245

Closed
beemibrahim opened this issue Jan 4, 2022 · 9 comments · Fixed by #3246
Closed

Add a function that checks for valid json in a C++ string #3245

beemibrahim opened this issue Jan 4, 2022 · 9 comments · Fixed by #3246
Assignees
Labels
documentation kind: question release item: 🔨 further change solution: proposed fix a fix for the issue has been proposed and waits for confirmation

Comments

@beemibrahim
Copy link

I want you to add a feature , that checks C++ strings for valid JSON . So that I don't get errors .

@nlohmann
Copy link
Owner

nlohmann commented Jan 4, 2022

@nlohmann nlohmann closed this as completed Jan 4, 2022
@nlohmann nlohmann added kind: question solution: proposed fix a fix for the issue has been proposed and waits for confirmation and removed kind: bug labels Jan 4, 2022
@beemibrahim
Copy link
Author

i didnt see any C++ strings

@nlohmann
Copy link
Owner

nlohmann commented Jan 4, 2022

The example shows how it can be used: https://json.nlohmann.me/api/basic_json/accept/#examples

@beemibrahim
Copy link
Author

In The Example What is The Type of the invalid text , also can I put a string in that auto variable

@nlohmann
Copy link
Owner

nlohmann commented Jan 4, 2022

Yes, a std::string is also a valid InputType.

@beemibrahim
Copy link
Author

alright thanks

@nlohmann
Copy link
Owner

nlohmann commented Jan 4, 2022

I will overwork the documentation and make it explicit that std::strings are allowed.

@nlohmann
Copy link
Owner

nlohmann commented Jan 4, 2022

@beemibrahim Would have been https://github.com/nlohmann/json/pull/3246/files easier to understand?

@beemibrahim
Copy link
Author

yes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation kind: question release item: 🔨 further change solution: proposed fix a fix for the issue has been proposed and waits for confirmation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants