Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
import ::serialization::caching
private import ::serialization::engine_tools
import ::serialization::caching
private import ::serialization::engine_tools
# Serializer of Nit objects to Json string.
class JsonSerializer
# Serializer of Nit objects to Json string.
class JsonSerializer
private var text: Text
# Root json object parsed from input text.
private var text: Text
# Root json object parsed from input text.
- private var root: nullable Jsonable is noinit
+ private var root: nullable Object is noinit
# Depth-first path in the serialized object tree.
# Depth-first path in the serialized object tree.
- private var path = new Array[JsonObject]
+ private var path = new Array[Map[String, nullable Object]]
# Last encountered object reference id.
#
# Last encountered object reference id.
#
init do
var root = text.parse_json
init do
var root = text.parse_json
- if root isa JsonObject then path.add(root)
+ if root isa Map[String, nullable Object] then path.add(root)
- if object isa JsonObject then
+ if object isa Map[String, nullable Object] then
var kind = null
if object.keys.has("__kind") then
kind = object["__kind"]
var kind = null
if object.keys.has("__kind") then
kind = object["__kind"]
# deserialized = deserializer.deserialize
# assert deserialized isa MyError
# ~~~
# deserialized = deserializer.deserialize
# assert deserialized isa MyError
# ~~~
- protected fun class_name_heuristic(json_object: JsonObject): nullable String
+ protected fun class_name_heuristic(json_object: Map[String, nullable Object]): nullable String