티스토리 뷰
1. 서버에서 내려 주는 문자열
{"RESULT":"OK","MESSAGE":"로그인 되었습니다.","NEXTPAGE":"/main"}
2. model 개체 생성
class Login {
String RESULT;
String MESSAGE;
String NEXTPAGE;
Login({
this.RESULT,
this.MESSAGE,
this.NEXTPAGE,
});
factory Login.fromJson(Map<String, dynamic> parsedJson) {
return Login(
RESULT: parsedJson['RESULT'],
MESSAGE: parsedJson['MESSAGE'],
NEXTPAGE: parsedJson['NEXTPAGE'],
);
}
}
3. 파싱 코드
var data= new model.Login.fromJson(json.decode(utf8.decode(response.bodyBytes)));
print(data.MESSAGE);
print(data.RESULT);
print(data.NEXTPAGE);
4. 결과
I/flutter ( 936): 로그인 되었습니다.
I/flutter ( 936): OK
I/flutter ( 936): /main
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
TAG
- Java
- kotlin
- JavaScript
- dart
- Review
- place
- Compile
- 엘리스센터
- samba
- Fun
- development
- devtools
- ssh
- Mobile
- TIP
- 맛집
- HTTP
- gpkiapi
- springboot
- food
- Linux
- Android
- devel
- json parse
- MySQL
- Security
- Spring
- web
- Flutter
- SSL
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
글 보관함