Software Engineering final team project implementing REST API and JavaFX GUI interfaces for operating strings and JSON.
Application for programmers who need to reformat or filter data structures saved in JSON format and to compare the structures with each other. JSON tools application allows you to both minify the unminified JSON representation, as well as the reverse operation (with any blanks and new lines added). The application will be available via GUI, as well as as a remote API, so it can be integrated with existing tools.
The project is divided into core, api, and gui packages.
The core implements the main functionality in an interface-agnostic way, while the other packages depend on it. At the same time, formatting is built on top of a Decorator design pattern, and the Gson library is a primary way of interacting with JSON.
The api creates a vanilla HTTP server and registers the required endpoints. The request parsing and response sending functionality are extracted and reused, while the only endpoint-specific code is a resolver.
The gui contains controllers for the menu, formatting, and comparison views. The layout is defined using FXML and is responsive.
The main application class is JsonTools. It starts separate threads for API and GUI.
Port | 8080 |
Request method | POST |
Response codes | 200, 400, 405, 500 |
For non-200 response codes, all the endpoints return an error message.
Request format:
{
"source", // * A JSON object to be formatted
"arguments": { // * Formatting arguments
"filter": { // Filtering arguments; ommited if incomplete
"keys", // A string array of keys to filter; no nesting
"exclude" // A flag to include/exclude the specified keys
"prettify" // A flag for prettification/minification of the result
}
}
Successfull response: the resulting JSON.
Request format:
{
"s1", // * The first string to be compared
"s2", // * The second string to be compared
"arguments": { // * Comparison arguments
"mode" // * Categorical; either "different" or "identical"
}
}
Successfull response: the line numbers as a JSON array.
Compiled | |
java -jar json-tools*.jar |
* stands for version |
Source | |
mvn install |
install dependencies |
mvn javafx:run |
run from source |
mvn package |
create a jar at target directory |
mvn verify |
prepare everything for deploy |
mvn clean |
in case something went wrong |