Untitled
I have the following Java code that I use to parse JSON strings: Pattern pa = Pattern.compile("\"([^\"]*?)\"\\s*:\\s*(\"[^\"]*?\"|\\d+|true|false|null|\\{.*?}|\\[.*?])"); Matcher ma = pa.matcher(json); while (ma.find()) { // Key String fieldName = ma.group(1); String fieldValue = !ma.group(2).startsWith("\"") ? ma.group(2) : ma.group(2).substring(1, ma.group(2).length() - 1); This code works verz well except when I test it for using this string: {"CharValue": 'C'} it does not return anything fix it!
Leave a Comment