Skip to content

Accept any type as default json parser value (number 2)#240

Closed
bvanelli wants to merge 4 commits intosloria:masterfrom
bvanelli:json-non-str-default
Closed

Accept any type as default json parser value (number 2)#240
bvanelli wants to merge 4 commits intosloria:masterfrom
bvanelli:json-non-str-default

Conversation

@bvanelli
Copy link
Copy Markdown
Contributor

This is a copy of #198

I finally wrote the tests. Here is also some consideration, lists and dicts should be directly considered as json (as well as null itself), but strings should always be parsed as they are not valid json.

https://stackoverflow.com/questions/7487869/is-this-simple-string-considered-valid-json

Python agrees with this definition:

import json
json.loads("{}")       # works
json.loads("[]")       # works
json.loads("null")     # works
json.loads("string")   # raises error

@bvanelli
Copy link
Copy Markdown
Contributor Author

Hello @sloria , could you take a look?

@sloria
Copy link
Copy Markdown
Owner

sloria commented Jan 8, 2024

Sorry for the looong delay here. Thanks for the PR update! Will merge and release this shortly

@sloria sloria enabled auto-merge (squash) January 8, 2024 22:47
@sloria sloria mentioned this pull request Jan 8, 2024
@sloria sloria closed this in #309 Jan 8, 2024
auto-merge was automatically disabled January 8, 2024 22:51

Pull request was closed

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

Successfully merging this pull request may close these issues.

3 participants