Android JSON Parsing Tutorial
JSON is very light weight, structured, easy to parse and much human readable. JSON is best alternative to XML when your android app needs to interchange data with your server.
In this tutorial we are going to learn how to parse JSON in android using different ways, using java.net library and other third part libraries.
-
JSON data数据源:https://api.androidhive.info/contacts/
-
需要完整的源码和解读请参考原文地址:https://www.androidhive.info/2012/01/android-json-parsing-tutorial/
-
注意需要在res/values下新建一个dimes.xml文件写入如下代码:
<?xml version="1.0" encoding="utf-8"?> <resources> <dimen name="activity_horizontal_margin">16dp</dimen> </resources>
其他地方如果有相应的包名也需要更改
使用 java.net library的运行截图:
如果有兴趣可以去上面的网址自己学一下用第三方库来实现的JSON parsing