【发布时间】:2017-03-13 15:18:02
【问题描述】:
我需要从 json 文件中提取 url。 (换成“”,不要破坏json格式),这样json中就没有url了。
网址是这样的
"source":"\u003ca href=\"http:\/\/twitter.com\/download\/iphone\",
"profile_image_url_https":"https:\/\/pbs.twimg.com\/profile_images\/3475536942\/2b0ccd9e42754adf7e22947037dd8c34_normal.jpeg","profile_banner_url":"https:\/\/pbs.twimg.com\/profile_banners\/488849893\/1364691799",
...
我注意到url中有“\”来转义字符串,我在写正则表达式时不知道如何处理。
【问题讨论】:
-
使用没有正则表达式的 json 解析器
-
我需要处理大量数据,这只是其中的一个示例。只使用解析器可能不是一个好主意?我不知道该网址位于哪个归档位置。
-
@Jens 是对的,如果您使用像 Jackson 这样的解析器,您可以将其配置为解析转义的 JSON。你有很多数据,这是使用像 Jackson 这样的解析器的原因之一 :)