Tuesday, September 24, 2013

RubyでJSON/XMLをPretty Printするgem prettyprint

ファイルまたは標準入力から受け取ったJSON/XMLをインデント表示するRuby製のツールprettyprintをgemで公開しました。

インストール

$ gem install prettyprint

使い方

prettyprint [json|xml] [filepath]

gemでインストールするとprettyprintコマンドが使えるようになります。prettyprintコマンドはxmlまたはjsonというサブコマンドを持ちます。ファイル名を指定するとそのファイルを入力とします。

$ prettyprint json input.json

ファイル名を省略すると、標準入力を受け付けます。

$ echo '<html><title>prettyprint</title><body>happy pretty printing</body></html>' | prettyprint xml
<html>
 <title>
  prettyprint
 </title>
 <body>
  happy pretty printing
 </body>
</html>

1 comment:

Unknown said...

As hobbyist enjoy journalists, we certainly have generally given anyone using cost-effective choices getting started in difficult wrist watches, together with options that fit this description. Nevertheless manner on the holiest about holies and particularly a person on a well-known and highly regarded view, offers nevertheless also been out of the question to the majority. Contains your five divide brands covering anything from the two-hand intelligent to your observe as well as offered in many call in addition to secure models http://www.replicabestsale.co.uk, the following different group all together is often a wonderful together with accept flying as a result of old systems.