Print
Details: Category: บทความ Flutter | Published: 03 February 2020 | Hits: 2894

มาดู การอ่าน JSON มาใน Flutter ใน Form แบบนี่บ้างครับ ต่อจาก ตอนที่แล้วครับ

 

https://www.androidthai.in.th/android-flutter/384-parsing-json-on-flutter-level2.html

 

Screen Shot 2563 01 17 at 082856

จากตอนที่แล้ว เป็น Array มาตอนนี่เป็น Map เราจะอ่าน JSON Form แบบนี่ มาทำงานใน Flutter อย่างไร ?

Screen Shot 2563 01 17 at 082934

เหมือนเดิ่ม กำหนดค่าให้ pubspec.yaml ก่อน

Screen Shot 2563 01 17 at 083051

ไปที่ https://javiercbk.github.io/json_to_dart/

Screen Shot 2563 01 17 at 083058

จะได้ Model แบบนี้ครับ

Screen Shot 2563 01 17 at 085023

Screen Shot 2563 01 17 at 085032

ได้ Model ละ

Screen Shot 2563 01 18 at 074954

ที่นีลอง ทดสอบโค้ด จะได้ผลแบบนี้ครับ