Skip to content

Commit

Permalink
Disable escaping when marshaling to JSON in query output
Browse files Browse the repository at this point in the history
  • Loading branch information
James Bielman committed Jul 6, 2017
1 parent 12acff8 commit 723ca5a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions cmd/e3db/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,12 @@ func doQuery(client *e3db.Client, useJSON bool, q *e3db.Q) {
fmt.Printf(",\n")
}

bytes, _ := json.MarshalIndent(record, " ", " ")
fmt.Printf(" %s", bytes)
buffer := bytes.Buffer{}
encoder := json.NewEncoder(&buffer)
encoder.SetEscapeHTML(false)
encoder.SetIndent(" ", " ")
encoder.Encode(record)
fmt.Printf(" %s", buffer.Bytes())
} else {
fmt.Printf("%-40s %s\n", record.Meta.RecordID, record.Meta.Type)
}
Expand Down

0 comments on commit 723ca5a

Please sign in to comment.