我的XML来自asmx。但出于一个原因,我想将其提取到javascript部分。
它有xml格式。但我只需要json部分,这是原始代码:
<string xmlns="http://tempuri.org/">
""[{\"OFFICE_NAME\":\"CE, MID WESTERN ZONE(FARIDPUR)\",\"OFFICE_ID\":\"20\"},{\"OFFICE_NAME\":\"CE, SOUTH WESTERN ZONE (KHULNA)\",\"OFFICE_ID\":\"25\"},{\"OFFICE_NAME\":\"CE, SOUTH EASTERN ZONE(CHITTAGONG)\",\"OFFICE_ID\":\"24\"},{\"OFFICE_NAME\":\"CE, NORTH EASTERN ZONE(SYLHET)\",\"OFFICE_ID\":\"21\"},{\"OFFICE_NAME\":\"CE, CENTRAL ZONE (DHAKA)\",\"OFFICE_ID\":\"18\"},{\"OFFICE_NAME\":\"CE, NORTHERN ZONE(RANGPUR)\",\"OFFICE_ID\":\"23\"},{\"OFFICE_NAME\":\"CE, EASTERN ZONE(COMILLA)\",\"OFFICE_ID\":\"19\"},{\"OFFICE_NAME\":\"CE, SOUTHERN ZONE(BARISAL)\",\"OFFICE_ID\":\"26\"},{\"OFFICE_NAME\":\"CE, NORTH WESTERN ZONE (RAJSHAHI)\",\"OFFICE_ID\":\"22\"},{\"OFFICE_NAME\":\"CE, MID WESTERN ZONE(FARIDPUR)\",\"OFFICE_ID\":\"20\"},{\"OFFICE_NAME\":\"CE, SOUTH WESTERN ZONE (KHULNA)\",\"OFFICE_ID\":\"25\"},{\"OFFICE_NAME\":\"CE, SOUTH EASTERN ZONE(CHITTAGONG)\",\"OFFICE_ID\":\"24\"},{\"OFFICE_NAME\":\"CE, NORTH EASTERN ZONE(SYLHET)\",\"OFFICE_ID\":\"21\"},{\"OFFICE_NAME\":\"CE, CENTRAL ZONE (DHAKA)\",\"OFFICE_ID\":\"18\"},{\"OFFICE_NAME\":\"CE, NORTHERN ZONE(RANGPUR)\",\"OFFICE_ID\":\"23\"},{\"OFFICE_NAME\":\"CE, EASTERN ZONE(COMILLA)\",\"OFFICE_ID\":\"19\"},{\"OFFICE_NAME\":\"CE, SOUTHERN ZONE(BARISAL)\",\"OFFICE_ID\":\"26\"},{\"OFFICE_NAME\":\"CE, NORTH WESTERN ZONE (RAJSHAHI)\",\"OFFICE_ID\":\"22\"}]""
</string>
所以,我要修剪<string xmlns="http://tempuri.org/">""
和"</string>
Frpm这我只需要提取json。但我怎么能这样做?
任何可用的功能?