commit b57a356bb638be402ccc169c1076c53792d2ebe4 (tree)
parent 62453496bac17f13e1e129de5cf08accddc02302
Author: OfekShochat <50481015+OfekShochat@users.noreply.github.com>
Date: Tue, 19 Apr 2022 08:15:30 +0300
std.json add stringify struct with string as array
Diffstat:
1 file changed, 5 insertions(+), 0 deletions(-)
diff --git a/lib/std/json.zig b/lib/std/json.zig
@@ -3268,6 +3268,11 @@ test "stringify struct" {
}{ .foo = 42 }, StringifyOptions{});
}
+test "stringify struct with string as array" {
+ try teststringify("{\"foo\":\"bar\"}", .{ .foo = "bar" }, StringifyOptions{});
+ try teststringify("{\"foo\":[98,97,114]}", .{ .foo = "bar" }, StringifyOptions{ .string = .Array });
+}
+
test "stringify struct with indentation" {
try teststringify(
\\{