java获取内嵌json数组,java解析Json中获取Array字段值及嵌套Json对象

获取响应内容:{"code":0,"message":"成功","data":{"docs":[{"fileId":"5cb99cccba6742ced9c894c019594015c7","fileName":"张三2021-01-27.pdf","fileUrl":"https://es33ig34noss.esign.cn/111156373486/3ce0c10d-c6cc-4a99-aa85-e2c1aa0065c2/%E9%BB%84%E6%89%BF%E5%AE%872021-01-27.pdf?Expires=1611753564&OSSAccessKeyId=LTAI4GJDCzRmsaAhkYbZFxUS&Signature=LhPXTAcU5%2FJQDzrggVV6J6aG%2FRE%3D"}]}}

java解析Json中获取Array字段值及嵌套Json对象

JSONObject downloadJson = SignHelper.downloadFlowDoc(flowId);

JSONObject json = null;

String address2 = null;

json = new JSONObject(downloadJson);

JSONArray jsonarr= json.getJSONArray("docs");

System.out.println("jsonarr==" + jsonarr);

String address1 = jsonarr.getJSONObject(0).getString("fileUrl");

address2 = jsonarr.getJSONObject(0).getString("fileId");

System.out.println("address1==" + address1);

System.out.println("address2==" + address2);

?i=20210127202530158.png?,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzQwMDY0MTE4,size_16,color_FFFFFF,t_70#pic_center

标签:段值,java,address1,address2,System,Json,JSONObject,jsonarr

来源: https://blog.csdn.net/qq_40064118/article/details/113269702

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值