xjtlujoe
V2EX  ›  问与答

json 数组的解析

  •  
  •   xjtlujoe · Jul 21, 2017 · 2718 views
    This topic created in 3399 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
    yidinghe
    PRO
    Jul 21, 2017 via Android
    1
    用专门的 json 解析库,例如 fastjson
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1257 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 17:24 · PVG 01:24 · LAX 09:24 · JFK 12:24
    ♥ Do have faith in what you're doing.