This repository was archived by the owner on Nov 6, 2024. It is now read-only.
Commit ed2594e
Fix manual (De)Serialize implementations with serde_json
The new Deserializer implementation (#107) does not work with the
'serde_json' crate, particularly `serde_json::{to_string,
from_str}`. The new implementation always expects `byte array` for
deserilaiztion. Meanwhile, the 'serde_json' crate always (de)serializes
`String` as `Vector` [1][2] which is treated as `sequence` (e.g. not
'byte array') by default for (de)serialization [3].
To fix this issue, this patch extends the new Deserializer
implementation to support both `byte array` and `sequence`.
[1] https://github.com/serde-rs/json/blob/cc7a1608c9bb7736c884926e016421af41a1ebe7/src/ser.rs#L2168-L2175
[2] https://github.com/serde-rs/json/blob/cc7a1608c9bb7736c884926e016421af41a1ebe7/src/de.rs#L30-L39
[3] https://serde.rs/data-model.html#types
Signed-off-by: Patrick Roy <[email protected]>
Signed-off-by: Bo Chen <[email protected]>1 parent d45810f commit ed2594e
2 files changed
+13
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
45 | 57 | | |
46 | 58 | | |
47 | 59 | | |
| |||
0 commit comments