json::parse(allow_exceptions = false) documentation is misleading. #2360
Labels
confirmed
documentation
kind: bug
release item: 🔨 further change
solution: proposed fix
a fix for the issue has been proposed and waits for confirmation
Milestone
What is the issue you have?
I'm a fan of the library and I try to update my code to new options / features regularly. This is a shortcoming of the documentation.
This time I ran into very weird bugs when I changed my security checks from using exceptions to the new form
(i.e. using
allow_exceptions = false
). I tried to follow the documentation, which describes the return value as follows:If the return value "is" something, then my understanding was that one can compare to it (this seemed a bit surprising but very much unambiguous). Turns out this doesn't work.
operator==
in the if-condition is resolved towhich as you can see wraps the rhs into a basic_json object, so my comparison is never going to yield equality.
Searching through the documentation for
"discarded"
I foundis_discarded()
which does the right thing, but whose documentation is woefully out of date:This clearly isn't in line with what parse() does.
Please describe the steps to reproduce the issue.
An example would be
Which version of the library did you use?
develop
branchI also checked the online docs.
The text was updated successfully, but these errors were encountered: