xjtlujoe
V2EX  ›  问与答

json 数组的解析

  •  
  •   xjtlujoe · Jul 21, 2017 · 2387 views
    This topic created in 3248 days ago, the information mentioned may be changed or developed.

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

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

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

    1 replies    2017-07-21 21:51:32 +08:00
    yidinghe
        1
    yidinghe  
       Jul 21, 2017 via Android
    用专门的 json 解析库,例如 fastjson
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3054 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 08:53 · PVG 16:53 · LAX 01:53 · JFK 04:53
    ♥ Do have faith in what you're doing.