如何将html数据转换为json对象?

我想了解从html到JSON对象的信息。

有人可以告诉我编写规则或提供任何教程的信息吗?

如何将html数据转换为json对象?

我尝试使用html url从日常运动中下载。

    protected void onPostExecute(String output) {
        super.onPostExecute(output);

        html = output;

        imagelist.add(getRegexBack(html,"property=\"og:image\" content=\"([^\"]+)\""));
        desc = getRegexBack(html,"property=\"og:description\" content=\"([^\"]+)\"");

        String sJs = getRegexBack(html,"\"qualities\":((.+?))\\}\\]\\}");

        if(!sJs.isEmpty()){sJs = sJs+"}]}";}

        try {

            JSONObject json = new JSONObject(sJs);

            for(int i=0; i < json.length(); i++){

                for(int o=0; o <  json.getJSONArray(json.names().get(i).toString()).length() ; o++){

                    String VIDEO = json.getJSONArray(json.names().get(i).toString()).getJSONObject(o).getString("url");

                    if(VIDEO.contains(".mp4")){

                        videolist.add(VIDEO);
                    }
                }

            }

        } catch (JSONException e) {e.getStackTrace();
        }

        if(videolist.size() == 0){
            videolist = getRegexBackArray(xmlCharacterConverter(html),"\"(http([^\\s\"]+)?\\.mp4([^\\s\"]+)?)\"");
            for(int v=0; v < videolist.size() ; v++){
                videolist.set(v,videolist.get(v).replace("\\",""));
            }
        }

        if(active){
            if(counter != 5){
                counter++;
            }
            mDialogAdvance();
        }else{
            mDialog = true;
        }
    }[

image

sdxfvxcvbxdjifnpgois 回答:如何将html数据转换为json对象?

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3161335.html

大家都在问