Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2022 04:18 AM
var str='var data = {"value":"abc","value2":"def","value3":"ghi"};';
var start=str.indexOf('{');
var end=str.indexOf('}');
var str=str.substring(start,end+1)
gs.info(str)
var data=JSON.parse(str); // Now you will have a valid JSON String
//Now access them as below
gs.info(data.value);// Now data.value1 will hold "abc";
gs.info(data.value2);// Now data.value2 will hold "def";
gs.info(data.value3);// Now data.value2 will hold "ghi";
Please mark it as helpful/correct If my answer is helpful in any way,
Best regards,
Thameem
I fixed the issue in my previous code
please try the above code. its tested