From aa6d513ca26aa6dadbad8ef04f9b02c7063dcb8d Mon Sep 17 00:00:00 2001 From: Moritz Date: Sun, 15 Nov 2026 14:37:08 +0100 Subject: [PATCH] fixed json to jsonc and added two example configs for testing --- example.jsonc | 15 +++++++++++++++ example.xml | 15 +++++++++++++++ src/config_editor.java | 10 +++++----- src/json_parse.java | 0 src/jsonc_parse.java | 3 +++ src/xml_parse.java | 3 +++ 6 files changed, 41 insertions(+), 5 deletions(-) create mode 100644 example.jsonc create mode 100644 example.xml delete mode 100644 src/json_parse.java create mode 100644 src/jsonc_parse.java create mode 100644 src/xml_parse.java diff --git a/example.jsonc b/example.jsonc new file mode 100644 index 0000000..ef98b72 --- /dev/null +++ b/example.jsonc @@ -0,0 +1,15 @@ +{ + // Example application configuration for testing. + "application": { + "name": "Config Editor Example", + "environment": "development" + }, + "server": { + "host": "localhost", + "port": 8080 + }, + "features": { + "logging": true, + "maintenanceMode": false + } +} diff --git a/example.xml b/example.xml new file mode 100644 index 0000000..ac6a5f8 --- /dev/null +++ b/example.xml @@ -0,0 +1,15 @@ + + + + Config Editor Example + development + + + localhost + 8080 + + + true + false + + diff --git a/src/config_editor.java b/src/config_editor.java index bab7a9b..1624d32 100644 --- a/src/config_editor.java +++ b/src/config_editor.java @@ -4,7 +4,7 @@ public class config_editor { static java.io.File config_file; enum ConfigFileType { - JSON, + JSONC, XML } @@ -29,14 +29,14 @@ public class config_editor { } static void config_file_type() { - if (config_file_path.endsWith(".json")) { - config_file_type = ConfigFileType.JSON; - System.out.println("JSON config file detected."); + if (config_file_path.endsWith(".jsonc")) { + config_file_type = ConfigFileType.JSONC; + System.out.println("JSONC config file detected."); } else if (config_file_path.endsWith(".xml")) { config_file_type = ConfigFileType.XML; System.out.println("XML config file detected."); } else { - System.err.println("Unsupported config file type. Please provide a .json or .xml file."); + System.err.println("Unsupported config file type. Please provide a .jsonc or .xml file."); } } diff --git a/src/json_parse.java b/src/json_parse.java deleted file mode 100644 index e69de29..0000000 diff --git a/src/jsonc_parse.java b/src/jsonc_parse.java new file mode 100644 index 0000000..9a14f47 --- /dev/null +++ b/src/jsonc_parse.java @@ -0,0 +1,3 @@ +public class jsonc_parse { + +} \ No newline at end of file diff --git a/src/xml_parse.java b/src/xml_parse.java new file mode 100644 index 0000000..6b0cc36 --- /dev/null +++ b/src/xml_parse.java @@ -0,0 +1,3 @@ +public class xml_parse { + +}