stred

Stred: Streaming Tree Editor. Like sed but for JSON
git clone http://shtanton.xyz/git/repo/stred
Log | Files | Refs

commit 61a32b2d3266e9c3661aef6842ba4a1913da2df0
parent 6f107b7a0ccfbcd3e2ec05d91c98877d9b2e0fc7
Author: Charlie Stanton <charlie@shtanton.xyz>
Date:   Wed, 15 Mar 2023 20:11:10 +0000

Fixes strings being wrapped in quotes twice when outputting

Diffstat:
Mwalk/walk.go | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/walk/walk.go b/walk/walk.go @@ -312,7 +312,7 @@ func jsonOutValue(in *WalkItemStream, indent int, doIndent bool) WalkValue { if !hasToken { panic("Missing JSON token in output") } - switch token.Value.(type) { + switch v := token.Value.(type) { case ValueNull: if doIndent { printIndent(indent) @@ -339,7 +339,7 @@ func jsonOutValue(in *WalkItemStream, indent int, doIndent bool) WalkValue { if doIndent { printIndent(indent) } - fmt.Printf("%q", token.Value) + fmt.Printf("%q", string(v)) return nil case TerminalValue: switch token.Value.(TerminalValue) {