我有這個json文件。部分原因是如下:正則表達式匹配換行
{ "has_more" : false,
"items" : [ { "aliases" : [ "http://www.stackoverflow.com" ],
"api_site_parameter" : "stackoverflow",
"markdown_extensions" : [ "Prettify" ],
"name" : "Stack Overflow",
"related_sites" : [ { "name" : "Stack Overflow Chat",
"relation" : "chat",
"site_url" : "http://chat.stackoverflow.com"
} ],
"site_state" : "normal",
"site_type" : "main_site",
"site_url" : "http://stackoverflow.com",
"styling" : { "link_color" : "#0077CC",
"tag_background_color" : "#E0EAF1",
"tag_foreground_color" : "#3E6D8E"
}
},
{ "api_site_parameter" : "serverfault",
"markdown_extensions" : [ "Prettify" ],
"name" : "Server Fault",
"related_sites" : [ { "api_site_parameter" : "meta.serverfault",
"name" : "Meta Server Fault",
"relation" : "meta",
"site_url" : "http://meta.serverfault.com"
},
{ "name" : "Chat Stack Exchange",
"relation" : "chat",
"site_url" : "http://chat.stackexchange.com"
}
],
"site_state" : "normal",
"site_type" : "main_site",
"site_url" : "http://serverfault.com",
"styling" : { "link_color" : "#10456A",
我要匹配像
"related_sites" : [ { "name" : "Stack Overflow Chat",
"relation" : "chat",
"site_url" : "http://chat.stackoverflow.com"
} ],
和
"related_sites" : [ { "api_site_parameter" : "meta.serverfault",
"name" : "Meta Server Fault",
"relation" : "meta",
"site_url" : "http://meta.serverfault.com"
},
{ "name" : "Chat Stack Exchange",
"relation" : "chat",
"site_url" : "http://chat.stackexchange.com"
}
],
串不啓用多。任何想法如何做到這一點?
使用JSON解析器請。 「 – nhahtdh