Mike
Mike7d ago

branch

Hi, I receive a JSON response from a service that if there is an error there will be an error object with the list of errors but if successful the error object will not exist. Is it possible to check for the existence of a object in a response with a branch (if/else) node?
3 Replies
AI Support
AI Support7d ago
AI Support Bot Information
<@1301431700030754889> you can react on the relevant answer (message) with a ✅ in this thread when you think it has been solved, by the bot or by a human! Anyone can react on this message with a ❌ if the GPT bot is unhelpful or hallucinating answers. Please note: Team members will review and answer the questions on best efforts basis.
AI Support
AI Support7d ago
AI Response
It seems I couldn't find specific information on using a branch (if/else) node to check for the existence of an object in your JSON response. However, typically, such logic is implemented by using a condition node in your workflow to verify whether an object exists or not. For more detailed support on how to set up this logic in BuildShip, please consider sending a support request via the in-app support feature.
BuildShip AI Support
Mike
MikeOP7d ago
I ended up adding an empty node and wiriting some JS
export default function checkForErrorObject({
jsonObject
} = {}) {

return !('Error' in jsonObject);
}
export default function checkForErrorObject({
jsonObject
} = {}) {

return !('Error' in jsonObject);
}