V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
xjtlujoe
V2EX  ›  问与答

json 数组的解析

  •  
  •   xjtlujoe · 2017-07-21 21:11:03 +08:00 · 1619 次点击
    这是一个创建于 2460 天前的主题,其中的信息可能已经有所发展或是发生改变。

    "creditcards":[
    {
    "id":"1368", "cardtype":"普卡", "customer":{
    "id2":"2357053", "custnum":"KHP002357053", .... }}]

    在学 android 开发,上面这个 json 数组得到 id 是: obj.setId(jsonobj.optString("id"));

    如果要得到 customer 下面的 id2 或者 custname,应该怎么做呢?

    1 条回复    2017-07-21 21:51:32 +08:00
    yidinghe
        1
    yidinghe  
       2017-07-21 21:51:32 +08:00 via Android
    用专门的 json 解析库,例如 fastjson
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3639 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 04:48 · PVG 12:48 · LAX 21:48 · JFK 00:48
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.