Skip to content
This repository has been archived by the owner. It is now read-only.
Tool to convert Java properties files into JavaScript
Branch: master
Clone or download
Latest commit b519d5c Jul 17, 2015
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib
src/net/nczonline/web/props2js
tests/net/nczonline/web/props2js
.gitignore
CHANGELOG
ISSUE_CREATE.md
LICENSE
README.md
ant.properties
build.xml

README.md

Props2Js

Notice: This utility has been end-of-lifed and is no longer supported. It is kept here for legacy purposes. If you're interested in taking over ownership of this project, please contact me.

Props2Js is a command line utility that converts Java properties files into one of three different formats:

  1. JSON
  2. JSONP
  3. JavaScript

The goal is to allow you to easily store configuration data that is needed for JavaScript in a simple format and then transform it into a format you need in your application.

Formats

JSON Format

To convert a properties file into JSON, use the following

java -jar props2js-x.y.z.jar source.properties -t json -o output.json

This reads in the properties file source.properties and outputs the JSON equivalent into output.json.

JSONP Format

To convert a properties file into JSON, use the following

java -jar props2js-x.y.z.jar source.properties -t jsonp --name myfunc -o output.jsonp

This reads in the properties file source.properties and outputs the JSONP equivalent into output.jsonp. This is the same as outputting as JSON except myfunc() is wrapped around the data.

JavaScript Format

To convert a properties file into JavaScript, use the following

java -jar props2js-x.y.z.jar source.properties -t js --name myvar -o output.js

This reads in the properties file source.properties and outputs the JavaScript equivalent into output.js. This is the same as outputting as JSON except var myvar= precedes the JSON and a semicolon follows it.

You can’t perform that action at this time.