Dong Khong Giang

unread,
Jun 10, 2016, 4:58:22 AM6/10/16
to MIT App Inventor Forum
I have a long json string as below. I can Parse one Json. But I don't know parse the long string
How can I add each string to a list and then using for each item in list?

[{"DEPARTMENT_BELONG":"20000","DEFECT_CODE":"2001","BIG_DEFECT":"Clean","VN_DEFECT":"Do Keo"},{"DEPARTMENT_BELONG":"20000","DEFECT_CODE":"2002","BIG_DEFECT":"Clean","VN_DEFECT":"Loi Bu"},{"DEPARTMENT_BELONG":"20000","DEFECT_CODE":"2003","BIG_DEFECT":"Clean","VN_DEFECT":"Dau Chi"},{"DEPARTMENT_BELONG":"20000","DEFECT_CODE":"2004","BIG_DEFECT":"Clean","VN_DEFECT":"In hinh"},{"DEPARTMENT_BELONG":"20000","DEFECT_CODE":"2005","BIG_DEFECT":"Clean","VN_DEFECT":"Long,short hair"},{"DEPARTMENT_BELONG":"20000","DEFECT_CODE":"2006","BIG_DEFECT":"Clean","VN_DEFECT":"Color bleeding"},{"DEPARTMENT_BELONG":"20000","DEFECT_CODE":"2007","BIG_DEFECT":"Clean","VN_DEFECT":"Khac mau"},{"DEPARTMENT_BELONG":"20000","DEFECT_CODE":"2008","BIG_DEFECT":"Straight","VN_DEFECT":"Nhan"},{"DEPARTMENT_BELONG":"20000","DEFECT_CODE":"2009","BIG_DEFECT":"Straight","VN_DEFECT":"May khong dung dinh vi va in hinh"},{"DEPARTMENT_BELONG":"20000","DEFECT_CODE":"2010","BIG_DEFECT":"Straight","VN_DEFECT":"Se so khong tron deu"},{"DEPARTMENT_BELONG":"20000","DEFECT_CODE":"2011","BIG_DEFECT":"Straight","VN_DEFECT":"Meo den"},{"DEPARTMENT_BELONG":"20000","DEFECT_CODE":"2012","BIG_DEFECT":"Straight","VN_DEFECT":"Meo mui"},{"DEPARTMENT_BELONG":"20000","DEFECT_CODE":"2013","BIG_DEFECT":"Straight","VN_DEFECT":"Meo got"},{"DEPARTMENT_BELONG":"20000","DEFECT_CODE":"2014","BIG_DEFECT":"Straight","VN_DEFECT":"Chan ben chi khong dong nhat"},{"DEPARTMENT_BELONG":"20000","DEFECT_CODE":"2015","BIG_DEFECT":"Straight","VN_DEFECT":"May lon size"},{"DEPARTMENT_BELONG":"20000","DEFECT_CODE":"2016","BIG_DEFECT":"Straight","VN_DEFECT":"Bao bien to nho"},{"DEPARTMENT_BELONG":"20000","DEFECT_CODE":"2017","BIG_DEFECT":"Straight","VN_DEFECT":"Day chu tai dai ngan"},{"DEPARTMENT_BELONG":"20000","DEFECT_CODE":"2018","BIG_DEFECT":"Straight","VN_DEFECT":"Duong may khong chong mui"},{"DEPARTMENT_BELONG":"20000","DEFECT_CODE":"2019","BIG_DEFECT":"Strong","VN_DEFECT":"Xu chi"},{"DEPARTMENT_BELONG":"20000","DEFECT_CODE":"2020","BIG_DEFECT":"Strong","VN_DEFECT":"Lo kim"},{"DEPARTMENT_BELONG":"20000","DEFECT_CODE":"2021","BIG_DEFECT":"Strong","VN_DEFECT":"Rach"},{"DEPARTMENT_BELONG":"20000","DEFECT_CODE":"2022","BIG_DEFECT":"Strong","VN_DEFECT":"Long chi, noi chi"},{"DEPARTMENT_BELONG":"20000","DEFECT_CODE":"2023","BIG_DEFECT":"Strong","VN_DEFECT":"Dut chi"}]

ScottFerguson

unread,
Jun 10, 2016, 7:41:11 AM6/10/16
to MIT App Inventor Forum
Using a combination of the Web component's JsonTextDecode block and list blocks you can access any entry data record and tag value:



JsonToList.aia

Abraham Getzler

unread,
Jun 10, 2016, 11:16:12 AM6/10/16
to MIT App Inventor Forum
Nice example.   Added it to the FAQ
ABG

Dong Khong Giang

unread,
Jun 10, 2016, 10:02:37 PM6/10/16
to mitappinv...@googlegroups.com
Thank you, ScottFerguson!
I make this block as you show me. Now, My problem is solved.




ScottFerguson

unread,
Jun 11, 2016, 6:59:10 AM6/11/16
to MIT App Inventor Forum
Nicely done!
Thanks for letting us know that it is working for you.
Happy Inventing!
Reply all
Reply to author
Forward
0 new messages