validateJsonString method
Decodes and checks one JSON configuration object, returning its map.
Supported Core-style comments and a leading BOM are accepted. Throws ArgumentError for malformed JSON, a non-object root or invalid inspected sections. The returned map is not a prepared native VPN configuration.
Implementation
Map<String, dynamic> validateJsonString(String config) {
final decoded = _decodeJson(config);
if (decoded is! Map<String, dynamic>) {
throw ArgumentError('Xray config must be a JSON object');
}
validate(decoded);
return decoded;
}