ACAT has migrated from XML to JSON for configuration files. This guide explains the changes and how to migrate existing configurations.
- Old Format:
Abbreviations.xml - New Format:
Abbreviations.json - POCO:
AbbreviationsJson(namespace:ACAT.Core.Configuration) - Validator:
AbbreviationsValidator(namespace:ACAT.Core.Validation)
{
"abbreviations": [
{
"word": "btw",
"replaceWith": "by the way",
"mode": "Write"
}
]
}Write- Expand abbreviation as textSpeak- Speak the expansionNone- No expansion
See /schemas/examples/abbreviations.example.json for a complete example.
- Old Format:
Pronunciations.xml - New Format:
Pronunciations.json - POCO:
PronunciationsJson(namespace:ACAT.Core.Configuration) - Validator:
PronunciationsValidator(namespace:ACAT.Core.Validation)
{
"pronunciations": [
{
"word": "github",
"pronunciation": "git hub"
}
]
}See /schemas/examples/pronunciations.example.json for a complete example.
- Actuator Settings:
ActuatorSettings.json - Panel Configuration:
PanelConfig.json - Theme Configuration:
Theme.json
All migrated configuration classes maintain backward compatibility with XML files:
- File Detection: The system checks for JSON files first, then falls back to XML if JSON is not found
- Automatic Format Detection: Based on file extension (
.jsonor.xml) - Transparent Loading: No code changes required in consuming code
For Abbreviations:
- Looks for
Abbreviations.jsonin resources directory - Looks for
Abbreviations.jsonin user directory - Falls back to
Abbreviations.xmlin resources directory - Falls back to
Abbreviations.xmlin user directory - Creates default
Abbreviations.jsonif none found
- Locate your existing XML configuration file
- Convert to JSON format using the examples as a template
- Save with
.jsonextension - The system will automatically use the JSON file
The ConfigMigrationTool application can convert XML configurations to JSON automatically.
All JSON configurations are validated using FluentValidation:
- Required fields are checked
- Data types are validated
- Enum values are verified
- Custom business rules are applied
- Invalid JSON: Falls back to defaults with error message
- Missing File: Creates default configuration
- Validation Failure: Falls back to defaults with detailed error messages
- Comments: Supports
//and/* */style comments - Trailing Commas: Allows trailing commas for easier editing
- Case-Insensitive: Property names are case-insensitive during deserialization
- Indented Output: Saved files are pretty-printed for readability
var abbreviations = new Abbreviations();
abbreviations.Load(); // Automatically tries JSON first, then XML
// Or specify a file
abbreviations.Load("/path/to/Abbreviations.json");var abbreviations = new Abbreviations();
abbreviations.Add(new Abbreviation("btw", "by the way", AbbreviationMode.Write));
abbreviations.Save(); // Saves as JSONvar loader = new JsonConfigurationLoader<AbbreviationsJson>(
new AbbreviationsValidator(),
logger
);
var config = loader.Load("/path/to/Abbreviations.json");Comprehensive test coverage is provided in:
ACATCore.Tests.Configuration/AbbreviationsTests.csACATCore.Tests.Configuration/PronunciationsTests.cs
Run tests with:
cd src/Libraries/ACATCore.Tests.Configuration
dotnet testTTS engine pronunciation file references have been updated:
- SAPI Engine:
SAPIPronunciations.json(was.xml) - TTS Client:
TTSPronunciations.json(was.xml)
Legacy XML files will still work due to backward compatibility.
Check the application logs for specific validation errors. Common issues:
- Empty required fields
- Invalid enum values (e.g., mode must be "Write", "Speak", or "None")
- Malformed JSON syntax
The system will create a default configuration. Check:
- File path is correct
- File has read permissions
- File extension is
.jsonor.xml
Check JSON syntax:
- All brackets and braces are matched
- Strings are properly quoted
- No trailing commas at the end of arrays/objects (unless using comment-tolerant parser)
Other configuration types may be migrated to JSON in future releases. The pattern established here will be followed:
- Create JSON POCO
- Create FluentValidation validator
- Update loader to support both JSON and XML
- Add comprehensive tests
- Update documentation
- POCOs:
/src/Libraries/ACATCore/Configuration/ - Validators:
/src/Libraries/ACATCore/Validation/ - Tests:
/src/Libraries/ACATCore.Tests.Configuration/ - Examples:
/schemas/examples/ - JsonConfigurationLoader:
/src/Libraries/ACATCore/Utility/JsonConfigurationLoader.cs