Open
Description
Zig Version
0.14.0
Steps to Reproduce and Observed Behavior
Min. repro:
const std = @import("std");
test {
const foo = .{
.a = std.math.inf(f32),
};
const str = try std.json.stringifyAlloc(std.testing.allocator, foo, .{});
defer std.testing.allocator.free(str);
std.log.warn("{s}", .{str});
}
The output: {"a":inf}
inf
is not a valid token in JSON. In my opinion, a parsing error should be thrown in cases with infinite values.
Expected Behavior
An error should be returned, instead of malformed json.