티스토리 뷰
프로젝트 진행중 API 호출 후 반환 되는 데이터 값을 파싱하여 쓰기 위해
모델을 만들어야했는데 생각보다 만드는게 귀찮고해서 찾다보니
JSON to Dart라는 웹사이트가 있어서 써보았는데 괜찮았다.
https://javiercbk.github.io/json_to_dart/
JSON to Dart
JSON to Dart Paste your JSON in the textarea below, click convert and get your Dart classes for free. Handcrafted by Javier Lecuona Github json_to_dart Code Twitter
javiercbk.github.io
사용방법은 API 호출 후 반환되는 JSON 값을 복사하고
위 사이트에 접속하여
이렇게 JSON에 붙여넣고 하단에 Your dart class name goes Here로 되어있는 곳에
내가 쓸 클래스 명을 입력후 Generate Dart를 클릭하면
이런식으로 클래스가 만들어진다.
이렇게 만든 클래스를 드래그해서 복사해도 되고 Copy Dart code to clipboard를 클릭해서 복사후
flutter의 프로젝트 폴더에 model파일을 만들고 붙여넣어서 쓰면 된다.
json_serializable 라는 라이브러리가 있어서 사용해봤지만
개인적으로 본인과 맞지 않아 사용하지 않는다.
'IT > 모바일' 카테고리의 다른 글
🛒 추천 상품
※ 이 포스팅은 쿠팡 파트너스 활동의 일환으로, 이에 따른 일정액의 수수료를 제공받습니다.
- Total
- Today
- Yesterday
- Failed to launch iOS Simulator: Error: Emulator didn't connect within 60 seconds
- NSPrivacyAccessedAPICategoryFileTimestamp
- Response: Failure when receiving data from the peer
- Xcode
- python3.12 설치
- Error (Xcode): Target release_unpack_ios failed: Exception: Binary
- 베란다 수경재배
- ios pod install error
- google play appcheck
- ios 앱 심사상태
- aws python3.12
- 해결방법
- but linking in object file
- com.google.android.gms.common.api.ApiException: 10:
- Firebase
- NSPrivacyAccessedAPICategoryUserDefaults
- EC2
- NSPrivacyAccessedAPICategoryDiskSpace
- CDN: trunk URL couldn't be downloaded
- PlatformException(sign_in_failed
- MySQL
- 리눅스 python3 설치
- 수경재배키트
- Flutter
- 슬랙으로 보내기
- flutter build ipa
- ITMS-91053: Missing API declaration
- ios
- NSPrivacyAccessedAPICategorySystemBootTime
- 아이폰
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |