Closed VigneshwaranJheyaraman closed 5 months ago
Thanks, but I don't think this is correct. "null"
is a valid string, so it should not be mapped to nil
.
(require '[jsonista.core :as j])
(j/read-value "{\"user-name\": \"null\"}")
; => {"user-name" "null"}
(j/read-value "{\"user-name\": null}")
; => {"user-name" nil}
Context
jsonista
when we try to convertjson-string
tomap
viajsonista.core/read-value
, the deserialization for works fine all cases EXCEPT forvalues
withnull
string. i.e.,(def parsed-json (jsonista.core/read-value json-string)) => dev/parsed-json
;; Instead of {"user-name" nil}, which we desire We get {"user-name" "null"} ;; This is because, the
Object
deserialization forString
doesn't handle this explicit scenario. Thus this fix;; After the current fix, we will get the output as {"user-name" nil}