json字符串类似于:
[ { "userPhone": "123", "userNo": "123-2", "userPassword": "123", "userName": "123" }, { "userPhone": "123", "userNo": "123-3", "userPassword": "123", "userName": "123" }, { "userPhone": "123", "userNo": "123-5", "userPassword": "\u67f1\u5b50", "userName": "1265544" }]
Java处理:
1 Gson gson = new Gson(); 2 List<Map<String, String>> resultList = gson.fromJson(responseStr, new TypeToken<List<Map<String, String>>>(){}.getType());
Gson导入:
Android:dependencies中添加
compile 'com.google.code.gson:gson:2.7'
Java:Mevan项目,pom中添加
1 <!-- Gson --> 2 <dependency> 3 <groupId>com.google.code.gson</groupId> 4 <artifactId>gson</artifactId> 5 <version>2.3.1</version> 6 </dependency>
非Mevan项目,自行去Mevan仓库中寻找jar导入项目:http://mvnrepository.com/