nitlanguage
/
nit.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
98c11eb
)
json: deser. chars serialized as strings and bytes as ints
author
Alexis Laferrière
<alexis.laf@xymus.net>
Thu, 27 Jul 2017 16:05:13 +0000
(12:05 -0400)
committer
Alexis Laferrière
<alexis.laf@xymus.net>
Thu, 10 Aug 2017 16:19:29 +0000
(12:19 -0400)
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
lib/json/serialization_read.nit
patch
|
blob
|
history
diff --git
a/lib/json/serialization_read.nit
b/lib/json/serialization_read.nit
index
3c8b170
..
13a48d1
100644
(file)
--- a/
lib/json/serialization_read.nit
+++ b/
lib/json/serialization_read.nit
@@
-326,6
+326,16
@@
class JsonDeserializer
return array
end
+ if object isa String and object.length == 1 and static_type == "Char" then
+ # Char serialized as a JSON string
+ return object.chars.first
+ end
+
+ if object isa Int and static_type == "Byte" then
+ # Byte serialized as an integer
+ return object.to_b
+ end
+
return object
end