xjtlujoe
V2EX  ›  问与答

json 数组的解析

  •  
  •   xjtlujoe · Jul 21, 2017 · 2388 views
    This topic created in 3249 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   ·   2886 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 15:01 · PVG 23:01 · LAX 08:01 · JFK 11:01
    ♥ Do have faith in what you're doing.