I am having trouble converting my string to JSON format.
I have this specific kind of string:
{Object1=Text Goes Right Here, and Here, Object2 = Another Text Here}
I wanted to convert it to something like this
{"Object1":"Text Goes Right Here, and Here", "Object2":"Another Text Here"}
Can anybody help me figure out how to properly convert this.
I tried using replaceAll but it keeps on breaking on the comma.
str.replaceAll('=', '":"').replaceAll(', ', '", "').replaceAll('{', '{"').replaceAll('}', '"}')
And it ended up like this.
{"Object1":"Text Goes Right Here", "and Here", "Object2":"Another Text Here"}
I also tried regexm but it is not replacing the actual strings.
/[^[a-zA-Z]+, [a-zA-Z]+":$']/g
A regex or anything that could help would be fine. Thank you in advance!