authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-06-25 20:33:24 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-06-25 20:33:24 -07:00
log7823ccf0c5d8243275f17b2c9017546f331c3a9f
treef8bc0a2c89af70ffcec1d6881d0d05a9f58132ee
parent9d6f17782df9681e56242e7a1bba6ec496e0e8a9
signaturebadge-check Signed by SSH key SHA256:4hHJbtBRU58AYXwjL7fkz2fnQHdiye8x1QpTCQ0sHNw

stringify: fix escapes


1 files changed, 10 insertions(+), 2 deletions(-)

json.zig+10-2
...@@ -729,7 +729,11 @@ pub fn stringify(writer: anytype, value: anytype, options: std.json.Stringify.Op...@@ -729,7 +729,11 @@ pub fn stringify(writer: anytype, value: anytype, options: std.json.Stringify.Op
729 try writer.writeAll("\"");729 try writer.writeAll("\"");
730 for (value) |c| {730 for (value) |c| {
731 try writer.writeAll(switch (c) {731 try writer.writeAll(switch (c) {
732 0x0c => "\\n",732 0x08 => "\\b",
733 0x09 => "\\t",
734 0x0a => "\\n",
735 0x0c => "\\f",
736 0x0d => "\\r",
733 0x20...0x21 => &.{c},737 0x20...0x21 => &.{c},
734 0x22 => "\\\"",738 0x22 => "\\\"",
735 0x23...0x7e => &.{c},739 0x23...0x7e => &.{c},
...@@ -751,7 +755,11 @@ pub fn stringify(writer: anytype, value: anytype, options: std.json.Stringify.Op...@@ -751,7 +755,11 @@ pub fn stringify(writer: anytype, value: anytype, options: std.json.Stringify.Op
751 try writer.writeAll("\"");755 try writer.writeAll("\"");
752 for (&value) |c| {756 for (&value) |c| {
753 try writer.writeAll(switch (c) {757 try writer.writeAll(switch (c) {
754 0x0c => "\\n",758 0x08 => "\\b",
759 0x09 => "\\t",
760 0x0a => "\\n",
761 0x0c => "\\f",
762 0x0d => "\\r",
755 0x20...0x21 => &.{c},763 0x20...0x21 => &.{c},
756 0x22 => "\\\"",764 0x22 => "\\\"",
757 0x23...0x7e => &.{c},765 0x23...0x7e => &.{c},