From d4a8f61220ef79b26dfeb0b719bdc7f9dd885d90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Espeute?= Date: Wed, 8 Apr 2026 09:35:53 +0200 Subject: [PATCH] [cdb] Prevent __id__ apprearing in saves in js emca 5.0 --- cdb/Parser.hx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cdb/Parser.hx b/cdb/Parser.hx index 612389b..107481c 100644 --- a/cdb/Parser.hx +++ b/cdb/Parser.hx @@ -191,7 +191,14 @@ class Parser { if( a.typeStr == null ) a.typeStr = cdb.Parser.saveType(a.type); Reflect.deleteField(a, "type"); } - var str = haxe.Json.stringify(data, null, "\t"); + var replaceFn = + #if( js_es == 5 ) + // filter out `__id__` keys that are added when the objects are used as key in Maps (haxe -> js ECMA 5.0 behavior) + (key, value) -> key == "__id__" ? js.Lib.undefined : value; + #else + null; + #end + var str = haxe.Json.stringify(data, replaceFn, "\t"); for( s in data.sheets ) { for( c in s.columns ) c.type = save.shift();