I have a csv file which contain this type of document:
{""cast_id"": 10, ""character"": ""Mushu (voice)"", ""credit_id"": ""52fe43a09251416c75017cbb"", ""gender"": 2, ""id"": 776, ""name"": ""Eddie Murphy"", ""order"": 0}, {""cast_id"": 62, ""character"": ""[Singing voice]"", ""credit_id"": ""597a65c8925141233d0000bb"", ""gender"": 2, ""id"": 18897, ""name"": ""Jackie Chan"", ""order"": 1}, {""cast_id"": 16, ""character"": ""Mulan (voice)"", ""credit_id"": ""52fe43a09251416c75017cd5"", ""gender"": 1, ""id"": 21702, ""name"": ""Ming-Na Wen"", ""order"": 2}
I used this regular expression first to change quadruple quote to double quote:
String newResult = result.replaceAll("\"{2}", "\"");
Then I use this regular expression to split this string:
String[] jsonResult = newResult.split(", (?![^{]*\\})");
However, it seperates the string into this:
{"cast_id": 10, "character": "Mushu (voice)", "credit_id": "52fe43a09251416c75017cbb", "gender": 2, "id": 776, "name": "Eddie Murphy", "order": 0}
{"cast_id": 62
"character": "[Singing voice
something else then
{"cast_id": 16, "character": "Mulan (voice)", "credit_id": "52fe43a09251416c75017cd5", "gender": 1, "id": 21702, "name": "Ming-Na Wen", "order": 2}
So my regular expression failed when it meets square brackets [], can I have some help with this?
I tried to use http://www.regexplanet.com/advanced/java/index.html but I don't understand what I should put in option, replacement and input. How do I use this website?
Thanks