From: Alexis Laferrière Date: Tue, 25 Jul 2017 15:26:50 +0000 (-0400) Subject: json: don't reserve an id when not using it X-Git-Url: http://nitlanguage.org json: don't reserve an id when not using it Signed-off-by: Alexis Laferrière --- diff --git a/lib/json/serialization_write.nit b/lib/json/serialization_write.nit index eeb30ff..d591b2e 100644 --- a/lib/json/serialization_write.nit +++ b/lib/json/serialization_write.nit @@ -242,10 +242,10 @@ redef class Serializable # which is used by all the serialization engines, not just JSON. protected fun accept_json_serializer(v: JsonSerializer) do - var id = v.cache.new_id_for(self) v.stream.write "\{" v.indent_level += 1 if not v.plain_json then + var id = v.cache.new_id_for(self) v.new_line_and_indent v.stream.write "\"__kind\": \"obj\", \"__id\": " v.stream.write id.to_s