mirror of https://github.com/goccy/go-json.git
Fix new line char
This commit is contained in:
parent
1e4216f0bc
commit
f7a6d65195
12
encode_vm.go
12
encode_vm.go
|
@ -223,7 +223,7 @@ func (e *Encoder) run(code *opcode) error {
|
||||||
code.ptr = header.Data
|
code.ptr = header.Data
|
||||||
} else {
|
} else {
|
||||||
e.encodeIndent(code.indent)
|
e.encodeIndent(code.indent)
|
||||||
e.encodeBytes([]byte{'[', ']', '\n'})
|
e.encodeBytes([]byte{'[', ']'})
|
||||||
code = headerCode.end.next
|
code = headerCode.end.next
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -259,7 +259,7 @@ func (e *Encoder) run(code *opcode) error {
|
||||||
} else {
|
} else {
|
||||||
e.encodeByte('\n')
|
e.encodeByte('\n')
|
||||||
e.encodeIndent(code.indent)
|
e.encodeIndent(code.indent)
|
||||||
e.encodeBytes([]byte{']', '\n'})
|
e.encodeByte(']')
|
||||||
code = c.end.next
|
code = c.end.next
|
||||||
}
|
}
|
||||||
case opRootSliceElemIndent:
|
case opRootSliceElemIndent:
|
||||||
|
@ -421,7 +421,7 @@ func (e *Encoder) run(code *opcode) error {
|
||||||
e.encodeIndent(code.indent)
|
e.encodeIndent(code.indent)
|
||||||
} else {
|
} else {
|
||||||
e.encodeIndent(code.indent)
|
e.encodeIndent(code.indent)
|
||||||
e.encodeBytes([]byte{'{', '}', '\n'})
|
e.encodeBytes([]byte{'{', '}'})
|
||||||
code = mapHeadCode.end.next
|
code = mapHeadCode.end.next
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -447,7 +447,7 @@ func (e *Encoder) run(code *opcode) error {
|
||||||
e.encodeIndent(code.indent)
|
e.encodeIndent(code.indent)
|
||||||
} else {
|
} else {
|
||||||
e.encodeIndent(code.indent)
|
e.encodeIndent(code.indent)
|
||||||
e.encodeBytes([]byte{'{', '}', '\n'})
|
e.encodeBytes([]byte{'{', '}'})
|
||||||
code = mapHeadCode.end.next
|
code = mapHeadCode.end.next
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -487,7 +487,7 @@ func (e *Encoder) run(code *opcode) error {
|
||||||
} else {
|
} else {
|
||||||
e.encodeByte('\n')
|
e.encodeByte('\n')
|
||||||
e.encodeIndent(code.indent - 1)
|
e.encodeIndent(code.indent - 1)
|
||||||
e.encodeBytes([]byte{'}', '\n'})
|
e.encodeByte('}')
|
||||||
code = c.end.next
|
code = c.end.next
|
||||||
}
|
}
|
||||||
case opRootMapKeyIndent:
|
case opRootMapKeyIndent:
|
||||||
|
@ -502,7 +502,7 @@ func (e *Encoder) run(code *opcode) error {
|
||||||
} else {
|
} else {
|
||||||
e.encodeByte('\n')
|
e.encodeByte('\n')
|
||||||
e.encodeIndent(code.indent - 1)
|
e.encodeIndent(code.indent - 1)
|
||||||
e.encodeBytes([]byte{'}'})
|
e.encodeByte('}')
|
||||||
code = c.end.next
|
code = c.end.next
|
||||||
}
|
}
|
||||||
case opMapValueIndent:
|
case opMapValueIndent:
|
||||||
|
|
Loading…
Reference in New Issue