{ "msg": "操作成功", "code": 200, "data": { "token": "eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6IjQzOTE4NTcxLTU5ZTYtNDRhZC04NzZmLTJmMzQ1MDI2MzA0ZiJ9.bB1G00Iyf_lpBdKxe3mkKrzJYeJ3PWldTCMtKEZy-hf-q_L0jwf1bM3Ol2JRlESKSKOeP99y9nrUCn5u9SrGhA" } }提取这个jsonObject中的token的值
时间: 2023-07-02 21:12:29 浏览: 306
可以使用代码对 JSON 字符串进行解析,然后提取 `token` 字段的值。以下是使用 Java 语言的示例代码:
```java
import org.json.JSONObject;
String jsonString = "{\"msg\":\"操作成功\",\"code\":200,\"data\":{\"token\":\"eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6IjQzOTE4NTcxLTU5ZTYtNDRhZC04NzZmLTJmMzQ1MDI2MzA0ZiJ9.bB1G00Iyf_lpBdKxe3mkKrzJYeJ3PWldTCMtKEZy-hf-q_L0jwf1bM3Ol2JRlESKSKOeP99y9nrUCn5u9SrGhA\"}}";
JSONObject jsonObject = new JSONObject(jsonString);
String token = jsonObject.getJSONObject("data").getString("token");
System.out.println(token);
```
输出结果为:
```
eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6IjQzOTE4NTcxLTU5ZTYtNDRhZC04NzZmLTJmMzQ1MDI2MzA0ZiJ9.bB1G00Iyf_lpBdKxe3mkKrzJYeJ3PWldTCMtKEZy-hf-q_L0jwf1bM3Ol2JRlESKSKOeP99y9nrUCn5u9SrGhA
```
阅读全文