fix(jsontools): print JSON, not YAML, in pp_json with the ruby method (#14263)

* fix(jsontools): print JSON, not YAML, in `pp_json` with the ruby method

The ruby implementation of `pp_json` converted the parsed input to YAML
(`to_yaml`), while the node and python3 implementations, and the README,
pretty-print JSON. Use `JSON.pretty_generate` with the same 4-space
indent as the other methods.

* test(jsontools): cover the ruby method
This commit is contained in:
Divya authored and GitHub committed 2026-11-22 10:16:39 -08:00
1 parent a7f4e49946
commit ca0a63f0ee
2 files changed
+55 -2

No files matched your search

+1 -2
View File
@@ -86,8 +86,7 @@ print(unquote_plus(sys.stdin.read()))
function pp_json() {
ruby -e '
require "json"
require "yaml"
puts JSON.parse(STDIN.read).to_yaml
puts JSON.pretty_generate(JSON.parse(STDIN.read), indent: " ")
'
}
function is_json() {