I have a string that looks like following:
{\n \"account_no\" = \"5675672343244\";\n \"account_kind\" = {\n \".tag\" = test,\n };\n country = US;\n disabled = 0;\n email = \"test@gmail.com\";\n \"email_verified\" = 1;\n \"is_paired\" = 0;\n };\n}"
It is similar to NSDictionary when it is printed as description to the console. Especially
- some strings are in quotes, some are not. See
country = US;\n
- they use k-v notation with
=
. E.g.key = value
- they use delimiter
;
Unfortunately I do not have the original object that created the string. I have only the string itself.
My goal is to transform it to a valid JSON string representation, or alternatively back to a NSDictionary. Should be done in Swift 5. I failed so far in doing so, does anyone has sample code that would help?