I'm trying to pull out the strings:
[{"name":"John Doe Jr."},{"name2":"John Doe"}] & {"name":"John Doe"}
from the payload in the JSON strings below:
{"to":"broadcast", "type":"50", "payload":[{"name":"John Doe Jr."},{"name2":"John Doe"}]}
{"to":"broadcast", "type":"50", "payload":{"name":"John Doe"}}
use this regex code:
Pattern pattern = Pattern.compile("\\{(.*?)\"payload\":\"(.*?)\"\\}\\}");
Matcher matcher = pattern.matcher(jsonString);
I'm getting an IllegalStateException: No successfull match so far
What is wrong with my regular expression?
Also how to I get the number of matches it finds?
Any help would be appreciated.