pub fn load_json(content: &str) -> Result<CommandsConfig>Expand description
Load configuration from a JSON string
Parses JSON content and deserializes it into a CommandsConfig.
Provides detailed error messages with line and column information
when parsing fails.
§Arguments
content- JSON string to parse
§Returns
Parsed CommandsConfig on success
§Errors
ConfigError::JsonParseif the JSON is invalid or doesn’t match the schema
§Example
use dynamic_cli::config::loader::load_json;
let json = r#"
{
"metadata": {
"version": "1.0.0",
"prompt": "test"
},
"commands": [],
"global_options": []
}
"#;
let config = load_json(json).unwrap();
assert_eq!(config.metadata.version, "1.0.0");