Tipik bir REST API JSON yanıtından Swift Codable struct'ları üretin. Anında çıktı üretir, tarayıcıda çalışır, sunucuya veri gönderilmez, ücretsiz.
// Generated by DevBento — json-to-typescript
interface RootAddress {
street: string;
city: string;
zip: string;
}
interface RootPostsItem {
title: string;
likes?: number;
}
interface Root {
id: number;
name: string;
email: string;
isActive: boolean;
roles: string[];
address: RootAddress;
posts: RootPostsItem[];
}Bu örnek, tipik bir REST API yanıtından Swift Codable struct’ları üretir. Önceden doldurulmuş JSON, iç içe adres, roller dizisi ve yazı nesneleri dizisi olan bir kullanıcı nesnesini temsil eder. Swift moduna geçerek üretilen struct’ları görün.
Araç şunları üretir:
Codable’a uygun kök Root struct’ıRootAddress struct’ıRootPostsItem struct’ıCodingKeys enum’uT?)String, Int, Double, Bool, [String]Swift Codable struct’ları, iOS ve macOS uygulamalarında JSON çözümlemenin standart yoludur. Üretilen kod doğrudan JSONDecoder().decode(T.self, from: data) ile çalışır. Yanıtta her zaman bulunmayan alanlar için isteğe bağlı türler kullanın.
Nothing you paste leaves this tab. Every tool runs entirely in your browser — no upload, no server, no account.