Simple Python utility for converting .properties files and directories to .json.
To copy a .properties file to a .json file
python properties2json.py <YOUR FILE>.properties
To copy a directory containing .properties files to .json
python properties2json.py <SRC> <DEST>
We convert the sample.properties file provided here
python properties2json.py sample.properties
We convert the sample_locales directory (which contains several .properties files) here
python properties2json.py sample_locales locales_converted
properties2json-converter is non-destructive, and able to convert .properties files containing multiple '=' characters, nesting and special characters, making it ideal for localization files.
some_link=<a href='/signin'>Log in</a>Converts to
"some_link":"<a href='/signin'>Log in</a>"Observe that [] and . notation may be used interchangeably through any depth.
A.B[C]=valueConverts to
{
"A": {
"B": {
"C": "value"
}
}
}We write to JSON's default utf-8 encoding.
country=中国
greeting=你好Converts to
{
"country": "中国",
"greeting": "你好"
}Substitute properties2json with properties2js to convert to .js files containing object literals instead.