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.

Output is sorted by key, 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
no=false
nothing=null
yes=true

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: =

-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.