I am retrieving the JSON request body from WebTau as a Map, e.g.:
Map<String,?> approvalMap = WebTauDsl.http.post(
callUrl, restCallHeader, restCallBody,
((header, body) ->
{
return body;
}
);
if( accessApprovalMap.get("id") instanceof Integer )
{
logger.info("id is Integer");
}
else if( accessApprovalMap.get("id") instanceof Long )
{
logger.info("id is Long");
}
From the logging code after the return ...
MonitorTest INFO : id is Integer
The question is what happens when the result is larger than MAX_INT is returned? BIGINT isn't very common at this point, but how would 'we' know? The string just looks like a number.
- Is there a way to override the type of a JSON field?
Behind the scenes WebTau uses com.fasterxml.jackson to parse JSON. It automatically handles types like
Long,Double, etcHere is a WebTau test to show numbers conversion.
Given JSON response
I am thinking that your response may not have a long enough number in your test.
If you provide more info on what you plan to do with the actual numbers, I may suggest an alternative way of achieving it.