jsontry − A tool to test JSON parsing in Emdros
jsontry [-d|-c|-u] json-filename
jsontry is a tool for testing the JSON parser in Emdros. It takes one argument, namely a filename. The file is opened and read, and parsed with the JSON parser embedded in Emdros. If an error occurs, the particulars of the error are written to stderr, the word "FAILURE" is written to stderr, and 2 is returned. If no parsing error occurs, the JSON is pretty-printed on stdout, the word "SUCCESS" is printed on stderr, and 0 is returned.
jsontry supports the following command-line switches:
−d |
For debugging: Upon parsing failure, print the input consumed by the lexer up until the syntax error occurred. The output is printed on stderr, just before the error message given by the parser is printed on stderr. Note that the lexer may have consumed the input further than the point at which the syntax error occurred. | ||
−c |
For minifying: Upon parsing success, prints the result as compacted, i.e., minified JSON. Implies -d. −u For Unicode-escaping: Upon parsing success, prints the result as compacted, i.e., minified JSON, which is also Unicode-escaped with \uxxxxxx for Unicode code points above 0x7F. Assumes the input is UTF-8 encoded. Implies -d. |
0
Success
1 Wrong usage
2 Error in parsing the JSON input
Written Ulrik Sandborg-Petersen (ulrikp@emdros.org).