response to be converted into integer type
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi Team,
I am getting response in floating but i need to have data type as integer in postman response.
How can i change the data type into integer ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
@Vijay Baokar you can explicitly convert them to integers using parseInt() or by ensuring they are calculated as integers.
var result = {
pageNumber: parseInt(pageNumber, 10),
pageLength: parseInt(pageLength, 10),
totalRecords: parseInt(totalCount, 10),
totalPages: parseInt(totalPages, 10),
"Status Code": 200,
"Message": users.length > 0 ? "Users retrieved successfully." : "No users with active status and 'hp.com' email domain were found.",
users: users
};
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
@Nilesh Pol its still giving me the same result.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
either use parseInt() while setting result
OR
handle it in previous line of codes
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @Ankur Bawiskar I am calling "retrieveUsers" function mentioned in the problem statement from a scripted rest API as below: