mirror of https://github.com/goccy/go-json.git
fix OpStructFieldOmitEmptyMarshalJSON with custom type marshaller on all VMs
This commit is contained in:
parent
42adc0a5ab
commit
53590387e6
|
@ -3646,8 +3646,13 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt
|
||||||
code = code.NextField
|
code = code.NextField
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
iface := ptrToInterface(code, p)
|
||||||
|
if code.Nilcheck && encoder.IsNilForMarshaler(iface) {
|
||||||
|
code = code.NextField
|
||||||
|
break
|
||||||
|
}
|
||||||
b = append(b, code.Key...)
|
b = append(b, code.Key...)
|
||||||
bb, err := appendMarshalJSON(code, b, ptrToInterface(code, p), false)
|
bb, err := appendMarshalJSON(code, b, iface, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -3646,8 +3646,13 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt
|
||||||
code = code.NextField
|
code = code.NextField
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
iface := ptrToInterface(code, p)
|
||||||
|
if code.Nilcheck && encoder.IsNilForMarshaler(iface) {
|
||||||
|
code = code.NextField
|
||||||
|
break
|
||||||
|
}
|
||||||
b = append(b, code.EscapedKey...)
|
b = append(b, code.EscapedKey...)
|
||||||
bb, err := appendMarshalJSON(code, b, ptrToInterface(code, p), true)
|
bb, err := appendMarshalJSON(code, b, iface, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -3901,10 +3901,15 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt
|
||||||
code = code.NextField
|
code = code.NextField
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
iface := ptrToInterface(code, p)
|
||||||
|
if code.Nilcheck && encoder.IsNilForMarshaler(iface) {
|
||||||
|
code = code.NextField
|
||||||
|
break
|
||||||
|
}
|
||||||
b = appendIndent(ctx, b, code.Indent)
|
b = appendIndent(ctx, b, code.Indent)
|
||||||
b = append(b, code.EscapedKey...)
|
b = append(b, code.EscapedKey...)
|
||||||
b = append(b, ' ')
|
b = append(b, ' ')
|
||||||
bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p), code.Indent+1, true)
|
bb, err := appendMarshalJSON(ctx, code, b, iface, code.Indent+1, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -3901,10 +3901,15 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt
|
||||||
code = code.NextField
|
code = code.NextField
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
iface := ptrToInterface(code, p)
|
||||||
|
if code.Nilcheck && encoder.IsNilForMarshaler(iface) {
|
||||||
|
code = code.NextField
|
||||||
|
break
|
||||||
|
}
|
||||||
b = appendIndent(ctx, b, code.Indent)
|
b = appendIndent(ctx, b, code.Indent)
|
||||||
b = append(b, code.Key...)
|
b = append(b, code.Key...)
|
||||||
b = append(b, ' ')
|
b = append(b, ' ')
|
||||||
bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p), code.Indent+1, false)
|
bb, err := appendMarshalJSON(ctx, code, b, iface, code.Indent+1, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue