You've already forked json-iterator
mirror of
https://github.com/json-iterator/go.git
synced 2025-06-24 23:16:47 +02:00
#95 struct and empty struct is considered as notempty
This commit is contained in:
@ -1092,13 +1092,8 @@ func (encoder *structEncoder) EncodeInterface(val interface{}, stream *Stream) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (encoder *structEncoder) IsEmpty(ptr unsafe.Pointer) bool {
|
func (encoder *structEncoder) IsEmpty(ptr unsafe.Pointer) bool {
|
||||||
for _, field := range encoder.fields {
|
|
||||||
if !field.encoder.IsEmpty(ptr) {
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
type emptyStructEncoder struct {
|
type emptyStructEncoder struct {
|
||||||
}
|
}
|
||||||
@ -1112,5 +1107,5 @@ func (encoder *emptyStructEncoder) EncodeInterface(val interface{}, stream *Stre
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (encoder *emptyStructEncoder) IsEmpty(ptr unsafe.Pointer) bool {
|
func (encoder *emptyStructEncoder) IsEmpty(ptr unsafe.Pointer) bool {
|
||||||
return true
|
return false
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user