| ... | ... | @@ -799,7 +799,7 @@ pub fn stringify(writer: anytype, value: anytype, options: std.json.Stringify.Op |
| 799 | 799 | try writer.writeAll("{"); |
| 800 | 800 | inline for (info.fields, 0..) |field, i| blk: { |
| 801 | 801 | const field_value = @field(value, field.name); |
| 802 | | if (@typeInfo(field.type) == .optional and field_value == null and !options.emit_null_optional_fields) break :blk; |
| 802 | if (((@typeInfo(field.type) == .optional and field_value == null) or @typeInfo(field.type) == .null) and !options.emit_null_optional_fields) break :blk; |
| 803 | 803 | if (i > 0) try writer.writeAll(","); |
| 804 | 804 | try stringify(writer, field.name, options); |
| 805 | 805 | try writer.writeAll(":"); |
| ... | ... | @@ -840,6 +840,9 @@ pub fn stringify(writer: anytype, value: anytype, options: std.json.Stringify.Op |
| 840 | 840 | .@"enum" => { |
| 841 | 841 | try T.stringifyJson(value, writer, options, @This()); |
| 842 | 842 | }, |
| 843 | .null => { |
| 844 | try writer.writeAll("null"); |
| 845 | }, |
| 843 | 846 | else => @compileError(@typeName(T)), |
| 844 | 847 | } |
| 845 | 848 | } |