-
Notifications
You must be signed in to change notification settings - Fork 606
Closed
Description
JSON objects can only have string keys, although HashMap
s can have many types of keys. In the case of i32
keys (eg HashMap<i32, i32>
), serde_json coerces the stringified integer key (eg "1"
) into 1i32
. However, that fails in the case of bool
keys; it raises an error when trying to coerce "true"
or "false"
into true
or false
:
Error("invalid type: string \"false\", expected a boolean", line: 0, column: 0)
I'm assuming the coercion behavior in the bool
case should be similar to the i32
case.
Playground reproduction is here: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=92d5a43496299513df591ec5a6f2832c
mikelui and anacrolix
Metadata
Metadata
Assignees
Labels
No labels