I query a PHP script on the server returning some php echos.
The snippet below is a JSON Fragment:
{"cid":"212"}
The whole output has some HTML fragments
<br>Order posted 214 - 192.168.1.22:4444 <br>{"cid":"214"}
What is the easiest way to filter the JSON part out of the rest ?
I know that it would be easier to kill all the other output, but still I would love to find a quick solution for this scenario.
Thx for the idea with the regex
Pattern pattern = Pattern.compile("\\{(.*?)\\}");
Matcher matcher = pattern.matcher(text);
while (matcher.find())
{
System.out.println(matcher.group(0));
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.