Currently, I am working with a JavaScript script that extracts data from a public Google Sheets feed in a JSON-CSV format that requires parsing.
The rows are separated by commas, but the challenge lies in dealing with unescaped commas within each item. For example:
"a: Feb 21, 10:11, b: some content, c: more, d: even more"
My objective is to achieve the following structure:
{
"a": "Feb 21, 10:11",
"b": "some content",
"c": "more",
"d": "even more"
}
Initial Splitting Attempt
Executing data.split(',') results in:
{
"a: Feb 21,
"10:11",
"b some content",
"c: more",
"d: even more"
}
Regex Experimentation
I have tried using the regex pattern: (?[^,]+): (?[^,]+), which almost accomplishes the task of wrapping the comma around a date value at the beginning of the next property occurrence.