I have an app that received a malformed JSON string like this:
{'username' : 'xirby'}
I need to replaced the single quotes '
with double quoates "
With these rule (I think):
{
with one or more spaces:
:
with one more spaces}
So this String {'username' : 'xirby'}
or
{ 'username' : 'xirby' }
Would be transformed to:
{"username" : "xirby"}
Update:
Also a possible malformed JSON String:
{ 'message' : 'there's not much to say' }
In this example the single quote inside the message value should not be replaced.
Try this regex:
\s*\'\s*
and a call to Replace with "
will do the job. Look at here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With