【JQuery Datatable 请求数据解析#yyds干货盘点#】弓背霞明剑照霜,秋风走马出咸阳。这篇文章主要讲述JQuery Datatable 请求数据解析#yyds干货盘点#相关的知识,希望能为你提供帮助。
请求数据
["name": "sEcho",
"value": 1
,"name": "iColumns",
"value": 6
,"name": "sColumns",
"value": ",,,,,"
,"name": "iDisplayStart",
"value": 0
,"name": "iDisplayLength",
"value": 10
,"name": "mDataProp_0",
"value": "id"
,"name": "sSearch_0",
"value": ""
,"name": "bRegex_0",
"value": false
,"name": "bSearchable_0",
"value": true
,"name": "bSortable_0",
"value": false
,"name": "mDataProp_1",
"value": "id"
,"name": "sSearch_1",
"value": ""
,"name": "bRegex_1",
"value": false
,"name": "bSearchable_1",
"value": true
,"name": "bSortable_1",
"value": true
,"name": "mDataProp_2",
"value": "name"
,"name": "sSearch_2",
"value": ""
,"name": "bRegex_2",
"value": false
,"name": "bSearchable_2",
"value": true
,"name": "bSortable_2",
"value": true
,"name": "mDataProp_3",
"value": "info"
,"name": "sSearch_3",
"value": ""
,"name": "bRegex_3",
"value": false
,"name": "bSearchable_3",
"value": true
,"name": "bSortable_3",
"value": true
,"name": "mDataProp_4",
"value": "status"
,"name": "sSearch_4",
"value": ""
,"name": "bRegex_4",
"value": false
,"name": "bSearchable_4",
"value": true
,"name": "bSortable_4",
"value": false
,"name": "mDataProp_5",
"value": null
,"name": "sSearch_5",
"value": ""
,"name": "bRegex_5",
"value": false
,"name": "bSearchable_5",
"value": true
,"name": "bSortable_5",
"value": false
,"name": "sSearch",
"value": ""
,"name": "bRegex",
"value": false
,"name": "iSortCol_0",
"value": 1
,"name": "sSortDir_0",
"value": "desc"
,"name": "iSortingCols",
"value": 1]
封装代码
public static Map<
String, Object>
init(String data)
Map<
String, Object>
map = new HashMap<
>
();
try
JsonFactory jsonFactory = new JsonFactory();
JsonParser jsonParser = jsonFactory.createParser(data);
String key = "";
String valuehttps://www.songbingjia.com/android/= "";
boolean flag = false;
while (true)
JsonToken jsonToken = jsonParser.nextToken();
if (jsonToken == JsonToken.END_ARRAY)
break;
String currentName = jsonParser.getCurrentName();
if (currentName != null &
&
currentName.equals("name"))
jsonParser.nextToken();
key = jsonParser.getText();
flag = false;
if (currentName != null &
&
currentName.equals("value"))
jsonParser.nextToken();
value = https://www.songbingjia.com/android/jsonParser.getText();
flag =false;
//去掉值为null、“”的字结果
if(value!=null &
&
value.length()>
1)
flag = true;
if (flag)
map.put(key, value);
catch (Exception e)
e.printStackTrace();
return map;
推荐阅读
- 简单学习一下ibd数据文件解析
- SpringBoot Redis五种数据类型的简单操作
- Selenium3自动化测试31Cookie处理
- #yyds干货盘点# 程序员是这样学习中药学知识的,先用python采集分析一波
- 初识dosker+安装docker
- CentOS8安装Geant4笔记(Geant4介绍编译和安装)
- (服务注册是如何发起的)
- Spring认证指南(了解如何使用 Gemfire 的数据结构构建应用程序)
- JavaScript 数据处理 - 映射表篇