diff --git a/encode_vm.go b/encode_vm.go index 694ff17..dcea6c1 100644 --- a/encode_vm.go +++ b/encode_vm.go @@ -7936,7 +7936,9 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte if p == 0 || uintptr(array.data) == 0 { code = code.nextField } else { + b = append(b, code.key...) code = code.next + store(ctxptr, code.idx, p) } case opStructFieldSlice: b = append(b, code.key...) @@ -7951,7 +7953,9 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte if p == 0 || uintptr(slice.data) == 0 { code = code.nextField } else { + b = append(b, code.key...) code = code.next + store(ctxptr, code.idx, p) } case opStructFieldMap: b = append(b, code.key...) @@ -7969,7 +7973,9 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte if mlen == 0 { code = code.nextField } else { + b = append(b, code.key...) code = code.next + store(ctxptr, code.idx, p) } } case opStructFieldMapLoad: @@ -7988,7 +7994,9 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte if mlen == 0 { code = code.nextField } else { + b = append(b, code.key...) code = code.next + store(ctxptr, code.idx, p) } } case opStructFieldStruct: diff --git a/encode_vm_escaped.go b/encode_vm_escaped.go index 839da2c..9a08d36 100644 --- a/encode_vm_escaped.go +++ b/encode_vm_escaped.go @@ -7922,7 +7922,9 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode) if p == 0 || uintptr(array.data) == 0 { code = code.nextField } else { + b = append(b, code.escapedKey...) code = code.next + store(ctxptr, code.idx, p) } case opStructFieldSlice: b = append(b, code.escapedKey...) @@ -7937,7 +7939,9 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode) if p == 0 || uintptr(slice.data) == 0 { code = code.nextField } else { + b = append(b, code.escapedKey...) code = code.next + store(ctxptr, code.idx, p) } case opStructFieldMap: b = append(b, code.escapedKey...) @@ -7955,7 +7959,9 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode) if mlen == 0 { code = code.nextField } else { + b = append(b, code.escapedKey...) code = code.next + store(ctxptr, code.idx, p) } } case opStructFieldMapLoad: @@ -7974,7 +7980,9 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode) if mlen == 0 { code = code.nextField } else { + b = append(b, code.escapedKey...) code = code.next + store(ctxptr, code.idx, p) } } case opStructFieldStruct: