How to parse this response:
{af_sub1=1.5, af_deeplink=true, campaign=None, media_source=None, install_time=2018-05-08 03:34:34, af_status=Non-organic, path=, scheme=, host=}
as result of following code:
var onSuccess = function(result) {
console.log(result);
};
window.plugins.appsFlyer.initSdk(options,onSuccess,onError);
It's look like JSON, but using =
instead of :
, then I tried to parse it using result.af_sub1
and result["af_sub1"]
, both return undefined
You could first transform the response to conform to JSON and then parse it using
JSON.parse
. See the snippet below. Note that all data types will be strings and you need to take care of data type conversions yourself. I.e.af_deeplink
will not be a boolean.PS: For detailed explanations on the used regular expression please refer to the snippet I created on regex101.com