Need to create an object from the given variable string.
var text ='{"Origin":"Hybris","country":"Germany","Email":"senthilkumar@yopmail.com","Businesstype": "Global","region": "EMEA", "lang": "en_US}"}'
Need to create an object from the given variable string.
var text ='{"Origin":"Hybris","country":"Germany","Email":"senthilkumar@yopmail.com","Businesstype": "Global","region": "EMEA", "lang": "en_US}"}'
I hope this helps
let text = '{"Origin":"Hybris","country":"Germany","Email":"senthilkumar@yopmail.com","Businesstype":"Global","region":"EMEA","lang":"en_US"}';
let json = JSON.parse(text);
console.log(json);
JSON.parse(string)
Parses the string into the javascript object and
JSON.stringify(obj)
Converts the Javascript object into String.
In your scenario JSON.parse
would do the job.
Try using:
let text = '{"Origin":"Hybris","country":"Germany","Email":"senthilkumar@yopmail.com","Businesstype":"Global","region":"EMEA","lang":"en_US"}';
let json = JSON.parse(text);
console.log(json);
Hope this helps.