Standardize JSON output

json_encode options that we should use for editable json output (like composer.json) are only available on PHP 5.4 and above. This borrows the same routine used in composer, so that we get consistent easily editable 'pretty printed' output under all PHP versions.
Merge pull request #207 from geekwright/json

Standardize JSON output