json2properties

NAME

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

SYNOPSIS

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

Note

If the javaproperties package was installed but the json2properties script is not present, this command can still be run by replacing json2properties with python -m javaproperties.fromjson on the command line.

DESCRIPTION

Convert a JSON file infile to a .properties file and write the results to outfile. If not specified, infile and outfile default to sys.stdin and sys.stdout, 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

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

New in version 0.2.0.

Use <encoding> as the output encoding; default value: iso-8859-1 (a.k.a. Latin-1). (As all output is currently always pure ASCII, this option is not very useful.)

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

New in version 0.2.0.

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