json2properties

NAME

json2properties — Convert a JSON object to a Java .properties file

SYNOPSIS

json2properties [<OPTIONS>] [<infile> [<outfile>]]

DESCRIPTION

Convert a JSON file infile to a .properties file and write the results to outfile. If not specified, infile and outfile default to standard input and standard output, respectively.

The JSON document must be an object with scalar (i.e., string, numeric, boolean, and/or null) values; anything else will result in an error.

Key ordering is preserved in the output by default (unless the --sort-keys option is given), and numeric, boolean, & null values are output using their JSON representations; e.g., the input:

{
    "yes": true,
    "no": "false",
    "nothing": null
}

becomes:

#Mon Sep 26 18:57:44 UTC 2016
yes=true
no=false
nothing=null

Changed in version 0.7.0: Key ordering is now preserved by default instead of always being sorted

OPTIONS

-A, --ascii

New in version 0.6.0.

Escape all non-ASCII characters in the output with \uXXXX escape sequences. This overrides --unicode. This is the default behavior.

-c <comment>, --comment <comment>

New in version 0.5.0.

Show the given string as a comment at the top of the output

-E <encoding>, --encoding <encoding>

Use <encoding> as the output encoding; default value: iso-8859-1 (a.k.a. Latin-1)

-s <sep>, --separator <sep>

Use <sep> as the key-value separator in the output; default value: =

-S, --sort-keys

New in version 0.7.0.

Sort entries in output by key

-U, --unicode

New in version 0.6.0.

Output non-ASCII characters literally, except for characters that are not supported by the output encoding, which are escaped with \uXXXX escape sequences. This overrides --ascii.