# Current array open for deserialization, used by `SimpleCollection::from_deserializer`
private var opened_array: nullable Array[nullable Object] = null
- redef fun deserialize
+ redef fun deserialize(static_type)
do
errors.clear
- return convert_object(root)
+ return convert_object(root, static_type)
end
# User customizable heuristic to infer the name of the Nit class to deserialize `json_object`
var keys = v.path.last.get_or_null("__keys")
var values = v.path.last.get_or_null("__values")
+ if keys == null and values == null then
+ # Fallback to a plain object
+ for key, value_src in v.path.last do
+ var value = v.convert_object(value_src)
+
+ if not key isa K then
+ v.errors.add new AttributeTypeError(self, "keys", key, "K")
+ continue
+ end
+
+ if not value isa V then
+ v.errors.add new AttributeTypeError(self, "values", value, "V")
+ continue
+ end
+
+ self[key] = value
+ end
+ return
+ end
+
# Length is optional
if length == null and keys isa SequenceRead[nullable Object] then length = keys.length
# Metamodel
# Class inheritance graph as a `POSet[String]` serialized to JSON
-private fun class_inheritance_metamodel_json: NativeString is intern
+private fun class_inheritance_metamodel_json: CString is intern
redef class Sys
# Class inheritance graph