- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-07-2024 12:55 PM
I am doing a query against the sys_user table like so:
https://dev123456.service-now.com/api/now/table/sys_user?sysparm_limit=10
I notice some users have a department like this:
"department": ""
And others have a department like this:
"department": {
"link": "https://123456.service-now.com/api/now/table/cmn_department/5d7f17f03710200044e0bfc8bcbe5d43",
"value": "5d7f17f03710200044e0bfc8bcbe5d43"
},
This is problematic in a Java / Jackson context, as one is an empty String and the other is an Object. Convention dictates the empty String example would be either a null, or absent altogether from the response.
Is there a way to tell the query interface, "Send me nulls as null" or "Don't send me fields that are null", rather than, on my end, having to account for certain Objects being null if they're represented as blank Strings?
Thanks!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-07-2024 04:55 PM
You could add "sysparm_display_value" with value "all" to the URL in which case all fields would be represented as objects. That way by looking @ property "value" you could tell that the field is null, or not by checking that it is an empty string or not.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-07-2024 04:55 PM
You could add "sysparm_display_value" with value "all" to the URL in which case all fields would be represented as objects. That way by looking @ property "value" you could tell that the field is null, or not by checking that it is an empty string or not.