Generiere Swift Codable Structs mit CodingKeys aus einer verschachtelten Anwendungskonfiguration. Sofort kopierbarer Code für iOS- und macOS-Projekte.
// Generated by DevBento — json-to-typescript
interface RootApp {
name: string;
version: string;
debug: boolean;
}
interface RootDatabaseCredentials {
user: string;
password: string;
}
interface RootDatabase {
host: string;
port: number;
credentials: RootDatabaseCredentials;
}
interface RootFeatures {
darkMode: boolean;
maxConnections: number;
allowedOrigins: string[];
}
interface Root {
app: RootApp;
database: RootDatabase;
features: RootFeatures;
}Anwendungskonfigurationen haben tiefe Verschachtelung: App-Einstellungen, Datenbankanmeldedaten, Funktions-Flags. Dieses Beispiel generiert Swift Codable Structs aus einer mehrstufigen Konfigurationsstruktur, damit Sie Konfigurationsdateien direkt in Ihrer Swift-Anwendung deserialisieren können.
Das Werkzeug erzeugt:
Root mit drei übergeordneten Abschnitten: App, Database, FeaturesRootApp-Struct mit Name, Version, Debug-EigenschaftenRootDatabase-Struct mit Host, Port und dem verschachtelten Credentials-StructRootDatabaseCredentials-Struct für die DatenbankauthentifizierungRootFeatures-Struct mit DarkMode, MaxConnections und dem AllowedOrigins-ArrayString, Int, Double, Bool, [String]Swift-Konfigurationsladen mit Codable-Structs funktioniert nahtlos mit JSONDecoder. Generieren Sie Structs aus Ihrer Standardkonfiguration und decodieren Sie sie dann aus JSON-Dateien in Ihrem App-Bundle oder aus Netzwerkantworten.
Nothing you paste leaves this tab. Every tool runs entirely in your browser — no upload, no server, no account.