-
Notifications
You must be signed in to change notification settings - Fork 33
Open
Description
Thanks for the awesome work.
I was wondering if it's possible to somehow allow nullable fields in the define-json-type macro.
I think that this is indeed the expected behavior.
Example
(define-json-type <student>
(id)
(name)
(major "major" <major>))
(define-json-type <major>
(id)
(name)
(parent "parent" <major>))
(define json-str "{ \"id\": 1, \"name\": null, \"major\": null}")
(json->student json-str)error
In procedure assoc: Wrong type argument in position 2 (expecting association list): null
changing the json-str to the below
builds a correct (not unspecified) scheme object
(define json-str "{ \"id\": 1, \"name\": null, \"major\": {}}")
(json->student json-str)output
=> #<<student> id: 1 name: null major: #<<major> id: #<unspecified> name: #<unspecified> parent: #<unspecified>>>
also emitting the field major will produce correct results.
(define json-str "{ \"id\": 1, \"name\": null }")
(json->student json-str)output
=> #<<student> id: 1 name: null major: #<unspecified>>
Anything wrong with my approach?
Thanks again for your great work.
Metadata
Metadata
Assignees
Labels
No labels