environs icon indicating copy to clipboard operation
environs copied to clipboard

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

Open bvanelli opened this issue 3 years ago • 1 comments

This is a copy of https://github.com/sloria/environs/pull/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 avatar Dec 15 '21 02:12 bvanelli

Hello @sloria , could you take a look?

bvanelli avatar Apr 13 '22 10:04 bvanelli

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

sloria avatar Jan 08 '24 22:01 sloria