09-25-2024 01:01 PM
Hello all,
I'm trying to convert a string to a JSON structure, but I'm not succeeding because the format is wrong. The JSON.parse() method says that it's not valid format for a JSON.
Here is the string:
"{language=Tamil, taskId=123},{language=French (Europe), taskId=124},{language=Russian, taskId=125}"
I was hoping that the missing double quotes and that the "=" instead of ":" would be interpreted and fixed, but I'm getting an error:
failure:
"Unable to parse JSON value"
value:
"Please check the format of the JSON value"
reason:
"Please check the format of the JSON value"
I could do some regex to add the missing double quotes and replace the "=" by ":", but is there an easier way or a way that's best recommended?
Thanks in advance to anyone who can help! 🙂
JF
Solved! Go to Solution.
09-25-2024 01:47 PM
That's the only way since your string is definitely not valid JSON. You need it to look like this:
{"language": "Tamil", "taskId": 123}
09-26-2024 03:26 PM - edited 09-26-2024 03:27 PM
Great! Good that you have control over the source of the string.