json解析查找指定数据字段
json
适用于现代 C++ 的 JSON。
项目地址:https://gitcode.com/gh_mirrors/js/json

·
String strData = "{" + "userbean" + ":" + "{" + "Uid" + ":"
+ "100196" + "," + "Showname" + ":"
+ "\u75af\u72c2\u7684\u7334\u5b50" + "," + "Avtar"
+ ":null," + "State" + ":1}" + "}";
JSONTokener jsonParser = new JSONTokener(strData);
JSONObject person = null;
try {
person = (JSONObject) jsonParser.nextValue();
System.out.println("person=======" + person); // 这里可以成功读取
// String str = person.getString("Showname").toString(); //
// 这里读取失败
String uid = person.getJSONObject("userbean").getString(
"Showname");
System.out.println("uid==" + uid);
String strUserbean = person.getJSONObject("userbean")
.getString("Uid");
System.out.println("str==" + strUserbean);
String sta = person.getJSONObject("userbean")
.getString("State");
System.out.println("sta==" + sta);
} catch (JSONException e) {
e.printStackTrace();
System.out.println("fail...");
}




适用于现代 C++ 的 JSON。
最近提交(Master分支:5 个月前 )
34665ae6
binary -> binary_t
Signed-off-by: Robert Chisholm <robert.chisholm@sheffield.ac.uk> 4 天前
f3dc4684
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.28.9 to 3.28.10.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/9e8d0789d4a0fa9ceb6b1738f7e269594bdd67f0...b56ba49b26e50535fa1e7f7db0f4f7b4bf65d80d)
---
updated-dependencies:
- dependency-name: github/codeql-action
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> 11 天前
更多推荐
所有评论(0)