I have something like this
{
"client_id" = "some-id";
context = "{\"canal\":{\"canal\":\"SMARTPHONE\",\"reduction\":\"IOS\"},\"userAppVersion\":1300}";
messageid = "00000-0000-000-000-0000";
regime = null;
}
This is a log from NSDictionary object in Objective-C.
I want to format this output to a valid JSON format using JavaScript.
I have already try to replace some patterns like " = "
to ":" or " \"
to double quote (")
, but I have a problem to add double quotes on some keys and remove double quotes before some curly braces.
Expected result
{
"client_id" : "some-id",
"context" : {"canal":{"canal":"SMARTPHONE","reduction":"IOS"},"userAppVersion":1300},
"messageid" : "00000-0000-000-000-0000",
"regime" : null
}
Any idea?