1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

JSONをTypeScriptの独自型定義にさっくり変換

Last updated at Posted at 2020-02-03

独自型定義

const obj: MyObj = JSON.parse('{"name": "jack", "age": 8}'); 

interface MyObj {
  name: string;
  age: number
}

Array<独自型>


const objList: Array<MyObj> = JSON.parse('[{"name": "jack", "age": 8}, {"name": "john", "age": 10}]'); 

interface MyObj {
  name: string;
  age: number
}

他にいい方法があれば教えてクレメンス

1
0
5

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?