From 0d8c191b4fab5d87f71f3d9e9b2b1269a8e618b8 Mon Sep 17 00:00:00 2001 From: Laurent Arnoud Date: Fri, 8 Oct 2010 23:59:16 +0200 Subject: bin/prettify_json.rb: Set max_nesting and create_additions to false like edit_json it refers to http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=561839 Signed-off-by: Laurent Arnoud --- bin/prettify_json.rb | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/bin/prettify_json.rb b/bin/prettify_json.rb index 5e1f806..943546f 100755 --- a/bin/prettify_json.rb +++ b/bin/prettify_json.rb @@ -53,18 +53,21 @@ EOT end filename = nil -json = JSON[ - if args.empty? - STDIN.read - else - File.read filename = args.first - end -] +str = nil +json_opts = {:max_nesting => false, :create_additions => false} + +if args.empty? + str = STDIN.read +else + str = File.read(filename = args.first) +end + +json = JSON[str, json_opts] output = if opts['s'] - JSON.fast_generate json + JSON.fast_generate json, json_opts else # default is -l - JSON.pretty_generate json + JSON.pretty_generate json, json_opts end if opts['i'] && filename -- cgit v1.2.1