- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2023 05:57 AM
HI
var chr = [{"Discount5":"10","FeatureToken":"[{'tokenId': 'test', 'tokenOccurence': '1','tokenValue': 11111111}, {'tokenId': 'RCY', 'tokenOccurence': '1','tokenValue': 3}]"}];
var f = chr[0].FeatureToken;
gs.info("speed" + f);
var d = {"feature": +f};
gs.info("speed" + JSON.stringify(d));
for the above code i am getting the following results,
Why am i getting a null value for variable d, Can anyone help me with this?
need to place the array against feature.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2023 06:02 AM
You just have to remove + in your variable d assignment var d = {"feature": +f};
try below
var chr = [{"Discount5":"10","FeatureToken":"[{'tokenId': 'test', 'tokenOccurence': '1','tokenValue': 11111111}, {'tokenId': 'RCY', 'tokenOccurence': '1','tokenValue': 3}]"}];
var f = chr[0].FeatureToken;
gs.info("speed" + f);
var d = {"feature": f};
gs.info("speed" + JSON.stringify(d));

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2023 06:07 AM
@AbineshM Please update your script as follow.
var chr = [{"Discount5":"10","FeatureToken":"[{'tokenId': 'test', 'tokenOccurence': '1','tokenValue': 11111111}, {'tokenId': 'RCY', 'tokenOccurence': '1','tokenValue': 3}]"}];
var f = chr[0].FeatureToken;
gs.info("speed" + f);
var d = {"feature": f};
gs.info("speed" + JSON.stringify(d));
Now you should be able to stringify the value if d.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2023 06:02 AM
You just have to remove + in your variable d assignment var d = {"feature": +f};
try below
var chr = [{"Discount5":"10","FeatureToken":"[{'tokenId': 'test', 'tokenOccurence': '1','tokenValue': 11111111}, {'tokenId': 'RCY', 'tokenOccurence': '1','tokenValue': 3}]"}];
var f = chr[0].FeatureToken;
gs.info("speed" + f);
var d = {"feature": f};
gs.info("speed" + JSON.stringify(d));

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2023 06:07 AM
@AbineshM Please update your script as follow.
var chr = [{"Discount5":"10","FeatureToken":"[{'tokenId': 'test', 'tokenOccurence': '1','tokenValue': 11111111}, {'tokenId': 'RCY', 'tokenOccurence': '1','tokenValue': 3}]"}];
var f = chr[0].FeatureToken;
gs.info("speed" + f);
var d = {"feature": f};
gs.info("speed" + JSON.stringify(d));
Now you should be able to stringify the value if d.