JSON is not convenient for ordinary users to input configuration information. What other formats are suitable for ordinary people to use for configuration?
JSON is too complex, and manual input is very prone to errors.
The XML format is also the same; it is too difficult for ordinary users to use and very easy to make mistakes. Besides JSON and XML, what else is suitable for configuration files?
JSON (JavaScript Object Notation) is indeed not user-friendly for ordinary users, as it requires strict syntax (such as curly braces, double quotes, commas, no comments, etc.), making it very prone to errors.
For ordinary users to input configuration information, the following formats or methods are generally more suitable:
💡 Configuration Formats More Suitable for Ordinary Users
1. YAML (YAML Ain't Markup Language)
YAML is one of the most popular configuration file formats, and its biggest advantage is high readability and support for comments.
-
Advantages:
-
Minimalist syntax: Relies on indentation and line breaks to represent structure, rather than a large number of parentheses and quotes.
-
Supports comments: Users can use
#to add descriptive text. -
Intuitive data types: Lists, mappings (key-value pairs) are easily represented.
-
-
Example:
YAML# User configuration example username: John Doe age: 30 preferences: theme: dark notifications: true favorite_colors: - red - blue -
Applicable scenarios: Almost all situations requiring manual configuration, such as project settings, automation scripts, blog metadata, etc.
2. INI (Initialization File)
INI files are a long-standing configuration file format with a very simple structure, consisting of **sections** and **key-value pairs**.
-
Advantages:
-
Extremely simple structure: Easy to understand and write, with almost no learning curve.
-
High universality: Many older systems and cross-platform applications still use it.
-
Supports comments: Typically uses
;or#.
-
Example:
[User]
Username=John Doe
Age=30
[Preferences]
Theme=dark
Notifications=true
Use Cases: Application settings with shallow hierarchy and simple structure.
3. TOML (Tom's Obvious, Minimal Language)
TOML aims to be a "simple and easy-to-read" configuration language, combining the simplicity of INI and the hierarchical structure of YAML to some extent.
-
Advantages:
-
Excellent readability: The syntax is very clear and designed specifically for configuration.
-
Strict specification: The structure can express more complex data structures than INI (e.g., arrays, array of tables).
-
-
Example:
Ini, TOML# User info title = "TOML Example" [user] name = "John Doe" age = 30 [preferences] theme = "dark" colors = ["red", "blue"] # Array -
Use Cases: Modern projects that require well-defined specifications, such as Rust and Python project configurations.
🖱️ Better Interaction: Via Graphical Interface
If you want to completely eliminate the barrier of users learning configuration syntax, the best approach is not to let users edit files directly, but to provide an interactive interface:
4. Dedicated Graphical User Interface (GUI)
-
Concept: Provide a web page, desktop window, or in-app settings screen where users only need to click buttons, check boxes, drag sliders, or type into text fields.
-
Advantages:
-
Zero learning curve: Users interact only with visual elements.
-
Input validation: Immediate checks ensure user entries are valid, preventing mis-configuration.
-
Best user experience.
-
-
Use cases: Consumer-facing software, applications that require frequent setting changes, and back-office configuration panels of SaaS platforms.
5. Plain Text / Comma-Separated (CSV)
-
Concept: In very simple scenarios, allow users to input values separated by commas, spaces, or new lines.
-
Example:
-
Plain Text List: A list of email addresses that have access, with one address per line.
someA@it365.janqi.com somebody@it365.janqi.com -
Plain Text Key-Value Pairs: A list of key-value pairs separated by commas, spaces, or new lines.
Color=Red; Size=L
-
-
Applicable Scenarios: Simple input scenarios, such as managing a blacklist or a simple parameter list.
Comparison: YAML format seems to be a better choice for configuration files when it comes to simplicity and readability.
| Format/Method | Is Suitable for Ordinary Users? | Readability | Complexity of Structure | Recommended Scenarios |
| JSON | ❌ Not Suitable (Syntax Requirements Strict) | Medium | High | Data exchange between machines |
| YAML | ✅ Recommended (Balanced) | High | High | General application or project configuration |
| TOML | ✅ Recommended | High | Medium | Modern project configuration |
| INI | ✅ Recommended | Medium | Low | Simple structure, few levels of configuration |
| GUI (Graphical User Interface) | ⭐ Best | N/A | N/A | Software or service for ordinary users |