-1

I have a problem while parsing json which includes single quote. I am using JSONDecoder. I added response from API at below and I don't want to do any replacement or some regex operations. Are there any workaround for that?

"{\'value1\': true, \'value2\':\'2021-02-08\'}"
Cagdas
  • 101
  • 2
  • 9

1 Answers1

0

Your string is simply not valid JSON. Since it's not valid JSON there's no way to configure JSONDecoder to decode it.

If you aren't in charge of the service that outputs that string, the only thing you can do to use it with JSONDecoder is to modify the string to become valid JSON by, as you suggested, doing text replacement.

EmilioPelaez
  • 18,758
  • 6
  • 46
  • 50