【发布时间】:2017-04-28 02:32:26
【问题描述】:
这是我需要使用的 URL。
https://www2.chubb.com/us-en/claims/faq-auto.aspx
这里有折叠的问题,点击后会有与此相关的相应答案。
我的任务是将这些问题作为关键,将相应的答案作为价值。例如:
{
"What should I do in the event of an accident?": "Call 911 for emergency assistance, especially in the event of any injury. After calling 911, you should Remain at the scene of the accidentTake photos of the accident scene and vehicles involvedExchange insurance and contact information with anyone involved or witnesses to the accident "
}
我知道这些长值可能听起来很奇怪 ;-),但这是我需要的估值器。
我在网上搜索过这个。但我只能看到包含表格的 HTML 的解决方案。
如何开始创建这个 json?我还有一些用于处理此类数据的项目。
【问题讨论】:
-
那不是有效的 JSON。你应该更正它,然后阅读 JSoup for HTML parsing
-
@cricket_007,对不起,我做了正确的例子。谢谢
-
一定要用Java吗? Jquery 可以在一行中获取该数据
$($("div.expandCollapse div")[0]).text() -
@cricket_007,我真的很抱歉说你必须在 Java 中完成
-
好吧,那样的话,一定要试试JSoup