第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

為什么這段代碼在 TextView 中沒(méi)有返回任何值 無(wú)法從 json 獲取任何值

為什么這段代碼在 TextView 中沒(méi)有返回任何值 無(wú)法從 json 獲取任何值

qq_遁去的一_1 2022-06-15 10:12:14
在此代碼中,TextView 字段在傳遞給 json 時(shí)不能有任何值,并且警告是無(wú)法將 json 對(duì)象轉(zhuǎn)換為 json 數(shù)組String json = strListingsDetails;        try {            JSONArray jsonArray = new JSONArray(json);            JSONObject jsonObject = new JSONObject(jsonArray.getJSONObject(0).toString());            JSONArray dataListArray = jsonObject.getJSONArray("DataList");            if (dataListArray != null && dataListArray.length() != 0) {                for (int i = 0; i < dataListArray.length(); i++) {                    JSONObject jsonObject1 = dataListArray.getJSONObject(i);                    String listingId = jsonObject1.getString("ListingID");                    String specification = jsonObject1.getString("Specifications");                    String description = jsonObject1.getString("Description");                    String manufacturer = jsonObject1.getString("Manufacturer");                    String brand = jsonObject1.getString("Brand");                    String machineType = jsonObject1.getString("ManchineType");                    String condition = jsonObject1.getString("Condition");                    String yearOfMfg = jsonObject1.getString("YearofMfg");                    String Price=jsonObject1.getString("Price");                    String ShowPrice=jsonObject1.getString("ShowPrice");                    String country = jsonObject1.getString("Country");                    String state = jsonObject1.getString("State");                    String city = jsonObject1.getString("City");                    String qty = jsonObject1.getString("Qty");                    String height = jsonObject1.getString("Height");                    String width = jsonObject1.getString("Width");                    String length = jsonObject1.getString("Length");                    String weight = jsonObject1.getString("Weight");                    String warranty = jsonObject1.getString("Warranty");                    String expiredOn = jsonObject1.getString("ExpiredOn");
查看完整描述

2 回答

?
婷婷同學(xué)_

TA貢獻(xiàn)1844條經(jīng)驗(yàn) 獲得超8個(gè)贊

無(wú)法將 json 對(duì)象轉(zhuǎn)換為 json 數(shù)組


您正在嘗試解析 JSON 字符串,它是 JSON 對(duì)象而不是數(shù)組


像這樣試試。


JSONObject jsonObject = new JSONObject(json);

JSONArray dataListArray = jsonObject.getJSONArray("DataList");


查看完整回答
反對(duì) 回復(fù) 2022-06-15
?
呼如林

TA貢獻(xiàn)1798條經(jīng)驗(yàn) 獲得超3個(gè)贊

請(qǐng)按照我的猜測(cè)匹配您的json:


[

{

    "DataList": [

        {

            "ListingID": "value",

            "Specifications": "value",

            "Description": "value",

            "Manufacturer": "value",

            "Brand": "value"

             ...

        }

    ]

}

]

記錄你的json,你會(huì)找到答案


查看完整回答
反對(duì) 回復(fù) 2022-06-15
  • 2 回答
  • 0 關(guān)注
  • 93 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)