Copy-paste tool to convert Java class to JSON object.
Simple as Copy -> c2j -> Paste
Generates JSON object with simple values inserted for each attribute.
Comments, javadoc and annotations ignored.
- Download pre-built binary
/bin/c2j.exe
- Put it to
windows/system32
so it can b invoked from everywhere - Copy class fields you would like to convert
private String myString; /** * javadoc */ public int myNumber; @DynamoDBRangeKey(attributeName = "SK") protected Currency curr; //comment private Clz clz; private ClassNotInDict notInDict;
- Optionally create a
dict.txt
inC:\Users\{username}\class-to-json
file with{type}={value}
format
Seedict-exmaple.txt
Currency=USD Clz={"a":333}
- Run
c2j.exe
without any arguments - Result
{ "myString" : "asd", "myNumber" : 1, "curr" : "USD", "clz" : {"a":333}, "notInDict" : "default" }
c2j.exe
should be present in windows/system32
Then press Ctrl
two times and type
-d
is an optional argument to dict.txt
file, if you don't want to store it in ~home
folder.
c2j --help