Skip to content

JSON നിന്ന് TypeScript

നെസ്റ്റഡ് ഒബ്ജക്റ്റുകൾ, അറേകൾ, ഓപ്ഷണൽ ഫീൽഡുകൾ എന്നിവ കണ്ടെത്തി സാമ്പിൾ JSON-നെ TypeScript ഇന്റർഫേസുകളോ ടൈപ്പ് അലിയാസുകളോ ആക്കുക.

അപ്‌ലോഡ് ഇല്ല
export interface Root {
  id: number;
  name: string;
  email: string;
  active: boolean;
  tags: string[];
  address: Address;
  orders: Order[];
}

export interface Order {
  id: string;
  total: number;
  coupon?: string;
}

export interface Address {
  city: string;
  zip: null;
}

JSON നിന്ന് TypeScript എങ്ങനെ ഉപയോഗിക്കാം

  1. 1JSON നിന്ന് TypeScript തുറക്കുക. ഇത് നിങ്ങളുടെ ബ്രൗസറിൽ പ്രവർത്തിക്കുന്നു, സൈൻ-അപ്പ് വേണ്ട.
  2. 2നിങ്ങളുടെ ഇൻപുട്ട് ടൈപ്പ് ചെയ്യുക അല്ലെങ്കിൽ പേസ്റ്റ് ചെയ്യുക.
  3. 3ഫലം കോപ്പി ചെയ്യുക അല്ലെങ്കിൽ ഡൗൺലോഡ് ചെയ്യുക.

ചോദ്യങ്ങൾ

How are optional fields detected?

When an array contains objects and a key is missing from some of them, that key is marked optional with ?.

What about null values?

null is kept in a union, e.g. string | null, so you can see which fields can be empty.

Is my JSON uploaded?

No — conversion happens entirely in your browser.

കൂടുതൽ ടൂളുകൾ