From 589dbbddd20f444786e1d71258faf2f692450c49 Mon Sep 17 00:00:00 2001 From: dozn Date: Tue, 30 Dec 2025 17:02:06 -0800 Subject: [PATCH] [encoding/json] Fix Escapes When Marshalling Fixes https://github.com/odin-lang/Odin/issues/6060 and https://github.com/odin-lang/Odin/issues/6075 The boolean "true" was setting `html_safe` instead of `for_json`. Chalk one up for the "use enums instead of booleans" crowd. --- core/encoding/json/marshal.odin | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/encoding/json/marshal.odin b/core/encoding/json/marshal.odin index acf12331a..c4e348aa8 100644 --- a/core/encoding/json/marshal.odin +++ b/core/encoding/json/marshal.odin @@ -122,9 +122,9 @@ marshal_to_writer :: proc(w: io.Writer, v: any, opt: ^Marshal_Options) -> (err: case runtime.Type_Info_Rune: r := a.(rune) - io.write_byte(w, '"') or_return - io.write_escaped_rune(w, r, '"', true) or_return - io.write_byte(w, '"') or_return + io.write_byte(w, '"') or_return + io.write_escaped_rune(w, r, '"', for_json = true) or_return + io.write_byte(w, '"') or_return case runtime.Type_Info_Float: switch f in a {