diff options
| author | OfekShochat <50481015+OfekShochat@users.noreply.github.com> | 2022-04-19 08:15:30 +0300 |
|---|---|---|
| committer | Andreas Reischuck <andreas.reischuck@hicknhack-software.com> | 2022-05-10 09:55:06 +0200 |
| commit | b57a356bb638be402ccc169c1076c53792d2ebe4 (patch) | |
| tree | 427842fa8a2392ec2d614caecce434b2459f9aba | |
| parent | 62453496bac17f13e1e129de5cf08accddc02302 (diff) | |
| download | zig-b57a356bb638be402ccc169c1076c53792d2ebe4.tar.gz zig-b57a356bb638be402ccc169c1076c53792d2ebe4.zip | |
std.json add stringify struct with string as array
| -rw-r--r-- | lib/std/json.zig | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/std/json.zig b/lib/std/json.zig index b670e488b2..25bc2654db 100644 --- 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( \\{ |
