comma split in JSON String
Brought to you by:
aruckerjones,
sconway
Hello,
We encountered a bug parsing a csv file.
The following URL : https://www.test.com/home?language=en¶ms=A,B,C
is splitted by the first comma in A,B,C
when rendering the cell content.
This URL is in a String in a JSON object.
The complete JSON in the cell is :
{\"test\":\"A\",\"data1\":\"https://test.jpg\",\"image\":\"https://test.jpg\",\"URL\":\"{\"\"en\"\":\"\"https://www.test.com/home?language=en&country=gb¶ms=A,B,C\"\"}\"}
When we try to get the JSON content, the result is :
{\"test\":\"A\",\"data1\":\"https://test.jpg\",\"image\":\"https://test.jpg\",\"URL\":\"{\"\"en\"\":\"\"https://www.test.com/home?language=en¶ms=A
Here is an example
Without any test code to look at my only guess is that you are using a CSVParser - which is the original parser created for opencsv that predated the RFC4180 csv specifications and required quotes to be escaped with an escape character or a double quote and your string has both. Change out the CSVParser for an RFC4180Parser and I think that would work.
Thanks for your answer.
By replacing CSVParser with an RFC4180Parser , it works perfectly
Awesome! Yes I need to update the documentation to recommend everyone start with the RFC4180Parser and then use the CSVParser when they need something highly customizable.