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
in that method of script include which is returning result
var result = {
pageNumber: parseInt(pageNumber),
pageLength: parseInt(pageLength),
totalRecords: parseInt(totalCount),
totalPages: parseInt(totalPages),
"Status Code": 200,
"Message": users.length > 0 ? "Users retrieved successfully." : "No users with active status and 'hp.com' email domain were found.",
users: users
};
💡 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 Still getting the same response in postman:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
@Vijay Baokar You can explicitly format numbers as strings if the serialization process is not respecting integer values. This is a workaround to ensure that the numbers appear as integers in the JSON response:
for an example:
var result = {
pageNumber: pageNumber.toString(),
pageLength: pageLength.toString(),
totalRecords: totalCount.toString(),
totalPages: totalPages.toString(),
"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
did you add log and see what came in script include?
what's the issue with not having integer?
inform 3rd party and they will handle at their end
💡 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