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

JSON3.read parses literal successfully regardless of trailing text #288

Open
xlxs4 opened this issue Sep 6, 2024 · 0 comments
Open

JSON3.read parses literal successfully regardless of trailing text #288

xlxs4 opened this issue Sep 6, 2024 · 0 comments

Comments

@xlxs4
Copy link
Contributor

xlxs4 commented Sep 6, 2024

julia> JSON3.read("""true::[[[}}{sdfg""")
true

julia> JSON3.read("""1::[[[}}{sdfg""")
1

julia> JSON3.read(""""hi"::[[[}}{sdfg""")
"hi"

JSON errors instead, which I feel is more sensible:

julia> JSON.parse("""true::[[[}}{sdfg""")
ERROR: Expected end of input
Line: 0
Around: ...true::[[[}}{sdfg...
               ^

julia> JSON.parse("""1::[[[}}{sdfg""")
ERROR: Expected end of input
Line: 0
Around: ...1::[[[}}{sdfg...
            ^

julia> JSON.parse(""""hi"::[[[}}{sdfg""")
ERROR: Expected end of input
Line: 0
Around: ..."hi"::[[[}}{sdfg...

After read! there's a call to getvalue:

return getvalue(Any, buf, tape, 1, t)

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

No branches or pull requests

1 participant