Merge pull request #114 from z7zmey/feature-110

[#110] fix json dumper
This commit is contained in:
Vadym Slizov 2020-07-26 16:11:08 +02:00 committed by GitHub
commit 17d7cec2fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 0 deletions

View File

@ -120,6 +120,9 @@ func (d *JsonDumper) EnterNode(w walker.Walkable) bool {
// LeaveNode is invoked after node process // LeaveNode is invoked after node process
func (d *JsonDumper) LeaveNode(n walker.Walkable) { func (d *JsonDumper) LeaveNode(n walker.Walkable) {
fmt.Fprint(d.Writer, "}") fmt.Fprint(d.Writer, "}")
d.isNotFirstNode = true
d.isChildNode = false
} }
func (d *JsonDumper) EnterChildNode(key string, w walker.Walkable) { func (d *JsonDumper) EnterChildNode(key string, w walker.Walkable) {

View File

@ -157,6 +157,9 @@ func (d *PrettyJsonDumper) LeaveNode(n walker.Walkable) {
fmt.Fprint(d.Writer, "\n") fmt.Fprint(d.Writer, "\n")
d.printIndent(d.Writer) d.printIndent(d.Writer)
fmt.Fprint(d.Writer, "}") fmt.Fprint(d.Writer, "}")
d.isNotFirstNode = true
d.isChildNode = false
} }
func (d *PrettyJsonDumper) EnterChildNode(key string, w walker.Walkable) { func (d *PrettyJsonDumper) EnterChildNode(key string, w walker.Walkable) {