public class JSONFormatter
extends java.lang.Object
The purpose of this class is to provide a command line that will read a JSON file, clean it up, and write it out again in canonical form. That is, the keys of all the objects will be put in ASCII alphabetical order according to unicode code-point and not sorted according to any particular language sort order. The objects will then be formattted, and the values will then be properly indented with 2 spaces per indent level. The output is to the file name specified in the second paramter.
JSONFormatter {input-file-name} {output-file-name}
If the file being read is not in valid JSON format, then an error will be reported and no output produced.
Constructor and Description |
---|
JSONFormatter() |
Modifier and Type | Method and Description |
---|---|
static void |
main(java.lang.String[] args)
The purpose of this class is to provide a command line that will
read a JSON file, clean it up, and write it out again in canonical
form.
|
public static void main(java.lang.String[] args)
The purpose of this class is to provide a command line that will read a JSON file, clean it up, and write it out again in canonical form. That is, the keys of all the objects will be put in ASCII alphabetical order according to unicode code-point and not sorted according to any particular language sort order. The objects will then be formattted, and the values will then be properly indented with 2 spaces per indent level. The output is to the file name specified in the second paramter.
JSONFormatter {input-file-name} {output-file-name}
If the file being read is not in valid JSON format, then an error will be reported and no output produced.