Home > Forum > Actions > System.FormatException when mapping REST API JSON response to fields

System.FormatException when mapping REST API JSON response to fields
0

Update: There has been a bad return in the script that screwed the things up.

#

Hi,

I have a REST API endpoint in PowerShell Universal with the following code for the response:

[code]
$result = [PSCustomObject]@{
result = [PSCustomObject]@{
htmlLog = $html
}
isError = $isError #BOOL
errorCode = $errorCode #INT
errorMessage = $errorMessage
}
$json = $result | ConvertTo-Json -Depth 10 -Compress
return $json
[/code]

Mapping the response attributes to form fields (isError as bool and errorCode as int) throws these exceptions after the invoke:
- System.FormatException: String was not recognized as a valid Boolean.
- System.FormatException: Input string was not in a correct format.

Can anyone help on how to set the configuration in the response tab to get it to work?

Kind regards
Sébastien

Nobody has replied in this thread yet.