lib/json: the `__kind` attribute is optional
authorAlexis Laferrière <alexis.laf@xymus.net>
Mon, 29 Jun 2015 01:35:48 +0000 (21:35 -0400)
committerAlexis Laferrière <alexis.laf@xymus.net>
Mon, 29 Jun 2015 02:47:05 +0000 (22:47 -0400)
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

lib/json/serialization.nit

index e92a532..f2758b3 100644 (file)
@@ -213,8 +213,10 @@ class JsonDeserializer
                end
 
                if object isa JsonObject then
-                       assert object.keys.has("__kind")
-                       var kind = object["__kind"]
+                       var kind = null
+                       if object.keys.has("__kind") then
+                               kind = object["__kind"]
+                       end
 
                        # ref?
                        if kind == "ref" then
@@ -238,7 +240,7 @@ class JsonDeserializer
                        end
 
                        # obj?
-                       if kind == "obj" then
+                       if kind == "obj" or kind == null then
                                var id = null
                                if object.keys.has("__id") then
                                        id = object["__id"]