article directory
JSON String
- to Map, get leaf node
- Map to String String
JSON string to Map, get the leaf node
fastjson has two ways:
- json. parseObject (String, Class< T>)
//JSON subclass
- JSONObject.parseObject
String str ={
"sign": "sign",
"data": {
"type": "第二层",
"order": {
"test": "第三层"
}
}
}
Map<String,String> parseObject = JSON.parseObject(str,Map.class);
//获取sign节点
String sign=parseObject.get("sign");
//获取data节点
String data=String.valueOf(parseObject.get("data"));
//获取data集合
Map dataMap = JSON.parseObject(data,Map.class);
//获取order集合
Map orderMap = (Map)dataMap.get("order");
//获取叶子节点
orderMap.get("test");
Map String String
String str = JSONObject.toJSONString(testMap);
– tools
Read More:
- A solution to automatically convert special characters into Unicode when taking out data from MySQL and encapsulating it into JSON
- Quickly convert map to ordered array
- Transformation of JS map and JSON
- Could not write JSON: write javaBean error, fastjson version x.x.x, class
- com.alibaba.fastjson .JSONException: For input string: “3000-01-01” or “9999-12-31”
- Map to vector pair map.second sort
- 【ipfs-api】npm ERR! JSON.parse package.json must be actual JSON, not just JavaScript.
- Error handling when ABP specifies map object during map operation
- JSON data format net.sf.json .JSONException: A JSONObject text must begin with ‘{‘ at character 1 of Error:(f…
- Adding fastjson dependency to Maven project
- Object is JSON, and JSON is converted to object
- Android 9 (P) recovery upgrade Map of ‘@/cache/recovery/block.map’ failed problem analysis guide
- Unable to read workspace file ‘D:\angular.json‘: Invalid JSON character: “ “ at
- [go] solve the fatal error of go: concurrent map writes map non concurrent security
- [jQuery] jQuery operates on JSON strings or JSON objects
- Easynvr operation log reports an error. Fatal error: concurrent map read and map write troubleshooting
- Python json.dumps () json.dump The difference between ()
- Dependency frame package of Maven Alibaba JSON
- Error reading JSON file: json.decoder.JSONDecodeError : Extra data: line 6 column 2 (char 1329)