FlowRunner - Using external API to return JSON object/string results in decoding error

Hi,

I wanted to document this behavior that I’m seeing that I’m assuming to be a bug. I’ve set up a FlowRunner instance that calls a backendless API service to perform a complex query. The API service works as follows:

  • The service is called with a required input string “Product Name”
  • The string is split by space " " character into a list of keywords
  • Each of the keywords entails a Data Table object call to search for product names containing the given keyword.
  • Each of the resulting lists are returned, and compiled into an object in the format of `{“keyword”: [] }

The query executes as expected with a result: 200 in the API Services “Invoke”, the result of which is posted below:

However, when run from FlowRunner, the API service breaks with the following output:

The full error is here:

Summary

Error during execution of HTTP request. Can’t create instance of ‘[simple type, class java.lang.String]’ from passed JSON string due to problem with fields mappings. Cannot deserialize value of type java.lang.String from Object value (token JsonToken.START_OBJECT) at [Source: (String)“{“NOISETTE”:[{“categorie”:“Biscuits”,”___class":“Produits”,“bio”:true,“fournisseur”:null,“nom”:“Cookie choco noisette sans gluten”,“marque”:null},{“categorie”:“Biscuits”,“___class”:“Produits”,“bio”:true,“fournisseur”:null,“nom”:“Biscuit coeur choconoisette”,“marque”:null},{“categorie”:“Bonbons, choco”,“___class”:“Produits”,“bio”:true,“fournisseur”:“Superchoc”,“nom”:“Tablette chocolat noir noisette café”,“marque”:null},{“categorie”:“Fruits secs”,“___class”:“Produits”,“bio”:true,“fournisseur”:null"[truncated 2199 chars]; line: 1, column: 1]

This seems like some kind of issue decoding the JSON into an object, which is not a necessary behavior as I will be sending this output directly to an AI model for analysis.

I previously had the API setup such that the “Operation Response” was of type “Object”, but I’ve now switched it to type “String”, and I still get the same response, so I think the fault is on FlowRunner and not the API’s configuration.

Let me know if I can provide any extra clarification!

Ok, it seems that this has worked as a work-around for now:

Perhaps the mistake is on my part, I’m not sure. I will leave this here for clarification :slight_smile:

Hello @Maxime_Franchot,

Thank you for bringing up this important topic. It definitely highlights an issue that we should address. Could you please copy and share the response here that leads to the error?

Hi @sergey.kuk, the response is as follows:

This is the response I currently have, with the “convert to string” modifier before the output:

String Format Response

{"choco":[{"categorie":"Biscuits","___class":"Produits","bio":true,"fournisseur":null,"nom":"Cookie choco noisette sans gluten","objectId":"033FAB56-CD78-44D5-B559-6D8BA7A855D9","marque":null},{"categorie":"Bonbons, choco","___class":"Produits","bio":false,"fournisseur":"Sunshine","nom":"Tablette choco lait amandes","objectId":"04B1996C-D433-49C4-ADAE-9AA6FF5CF49B","marque":null},{"categorie":"Bonbons, choco","___class":"Produits","bio":false,"fournisseur":"Sunshine","nom":"Tablette choco noir éclats","objectId":"0AA72226-50C5-4CB7-BD2B-C6E4693A1F8F","marque":null},{"categorie":"Bonbons, choco","___class":"Produits","bio":true,"fournisseur":null,"nom":"Tablette choco lait caramel beurre salé","objectId":"1392C8A2-1782-43F5-B3E0-0DD4F66B9423","marque":null},{"categorie":"Biscuits","___class":"Produits","bio":true,"fournisseur":null,"nom":"Biscuit coeur choconoisette","objectId":"264FB284-6B49-42D4-9C7E-C16DF4DCE7ED","marque":null},{"categorie":"Bonbons, choco","___class":"Produits","bio":true,"fournisseur":"Superchoc","nom":"Tablette chocolat noir noisette café","objectId":"368A4013-3D64-4F1E-AA74-0592C2825327","marque":null},{"categorie":"Biscuits","___class":"Produits","bio":true,"fournisseur":null,"nom":"Biscuit nappé choco noir","objectId":"3DFE5837-4D85-4B28-B4D2-625FCB0660F5","marque":null},{"categorie":"Bonbons, choco","___class":"Produits","bio":true,"fournisseur":null,"nom":"Tablette chocolat noir 88%","objectId":"407CF5A5-C01F-4A6C-920C-5914B7E3193F","marque":null},{"categorie":"Biscuits","___class":"Produits","bio":true,"fournisseur":null,"nom":"Cookie tout choco Belledonne","objectId":"5C7D85F2-D19F-4E45-90C1-D6DAF45B5565","marque":null},{"categorie":"Bonbons, choco","___class":"Produits","bio":true,"fournisseur":null,"nom":"Palet chocolat noir 70%","objectId":"7752A0E5-BCCF-4E2F-9D35-CFFF9E5CDDA8","marque":null}],"noisette":[{"categorie":"Biscuits","___class":"Produits","bio":true,"fournisseur":null,"nom":"Cookie choco noisette sans gluten","objectId":"033FAB56-CD78-44D5-B559-6D8BA7A855D9","marque":null},{"categorie":"Biscuits","___class":"Produits","bio":true,"fournisseur":null,"nom":"Biscuit coeur choconoisette","objectId":"264FB284-6B49-42D4-9C7E-C16DF4DCE7ED","marque":null},{"categorie":"Bonbons, choco","___class":"Produits","bio":true,"fournisseur":"Superchoc","nom":"Tablette chocolat noir noisette café","objectId":"368A4013-3D64-4F1E-AA74-0592C2825327","marque":null},{"categorie":"Fruits secs","___class":"Produits","bio":true,"fournisseur":null,"nom":"Noisettes grillées","objectId":"9C9CAA13-7278-42A3-A2CF-AC62679C196F","marque":null},{"categorie":"Fruits secs","___class":"Produits","bio":true,"fournisseur":null,"nom":"Noisettes entières","objectId":"B0F1BC3E-BCAA-4D37-B8E3-7A0C5AF03AA2","marque":null},{"categorie":"Bonbons, choco","___class":"Produits","bio":false,"fournisseur":"Sunshine","nom":"Tablette choco lait noisettes","objectId":"C44336BB-CAE5-4ABC-B902-19161F8022CF","marque":null}]}

And here is the original response causing the bug, where the object is returned directly:

Object Format Response

{
“choco”: [
{
“categorie”: “Biscuits”,
“___class”: “Produits”,
“bio”: true,
“fournisseur”: null,
“nom”: “Cookie choco noisette sans gluten”,
“objectId”: “033FAB56-CD78-44D5-B559-6D8BA7A855D9”,
“marque”: null
},
{
“categorie”: “Bonbons, choco”,
“___class”: “Produits”,
“bio”: false,
“fournisseur”: “Sunshine”,
“nom”: “Tablette choco lait amandes”,
“objectId”: “04B1996C-D433-49C4-ADAE-9AA6FF5CF49B”,
“marque”: null
},
{
“categorie”: “Bonbons, choco”,
“___class”: “Produits”,
“bio”: false,
“fournisseur”: “Sunshine”,
“nom”: “Tablette choco noir éclats”,
“objectId”: “0AA72226-50C5-4CB7-BD2B-C6E4693A1F8F”,
“marque”: null
},
{
“categorie”: “Bonbons, choco”,
“___class”: “Produits”,
“bio”: true,
“fournisseur”: null,
“nom”: “Tablette choco lait caramel beurre salé”,
“objectId”: “1392C8A2-1782-43F5-B3E0-0DD4F66B9423”,
“marque”: null
},
{
“categorie”: “Biscuits”,
“___class”: “Produits”,
“bio”: true,
“fournisseur”: null,
“nom”: “Biscuit coeur choconoisette”,
“objectId”: “264FB284-6B49-42D4-9C7E-C16DF4DCE7ED”,
“marque”: null
},
{
“categorie”: “Bonbons, choco”,
“___class”: “Produits”,
“bio”: true,
“fournisseur”: “Superchoc”,
“nom”: “Tablette chocolat noir noisette café”,
“objectId”: “368A4013-3D64-4F1E-AA74-0592C2825327”,
“marque”: null
},
{
“categorie”: “Biscuits”,
“___class”: “Produits”,
“bio”: true,
“fournisseur”: null,
“nom”: “Biscuit nappé choco noir”,
“objectId”: “3DFE5837-4D85-4B28-B4D2-625FCB0660F5”,
“marque”: null
},
{
“categorie”: “Bonbons, choco”,
“___class”: “Produits”,
“bio”: true,
“fournisseur”: null,
“nom”: “Tablette chocolat noir 88%”,
“objectId”: “407CF5A5-C01F-4A6C-920C-5914B7E3193F”,
“marque”: null
},
{
“categorie”: “Biscuits”,
“___class”: “Produits”,
“bio”: true,
“fournisseur”: null,
“nom”: “Cookie tout choco Belledonne”,
“objectId”: “5C7D85F2-D19F-4E45-90C1-D6DAF45B5565”,
“marque”: null
},
{
“categorie”: “Bonbons, choco”,
“___class”: “Produits”,
“bio”: true,
“fournisseur”: null,
“nom”: “Palet chocolat noir 70%”,
“objectId”: “7752A0E5-BCCF-4E2F-9D35-CFFF9E5CDDA8”,
“marque”: null
}
],
“noisette”: [
{
“categorie”: “Biscuits”,
“___class”: “Produits”,
“bio”: true,
“fournisseur”: null,
“nom”: “Cookie choco noisette sans gluten”,
“objectId”: “033FAB56-CD78-44D5-B559-6D8BA7A855D9”,
“marque”: null
},
{
“categorie”: “Biscuits”,
“___class”: “Produits”,
“bio”: true,
“fournisseur”: null,
“nom”: “Biscuit coeur choconoisette”,
“objectId”: “264FB284-6B49-42D4-9C7E-C16DF4DCE7ED”,
“marque”: null
},
{
“categorie”: “Bonbons, choco”,
“___class”: “Produits”,
“bio”: true,
“fournisseur”: “Superchoc”,
“nom”: “Tablette chocolat noir noisette café”,
“objectId”: “368A4013-3D64-4F1E-AA74-0592C2825327”,
“marque”: null
},
{
“categorie”: “Fruits secs”,
“___class”: “Produits”,
“bio”: true,
“fournisseur”: null,
“nom”: “Noisettes grillées”,
“objectId”: “9C9CAA13-7278-42A3-A2CF-AC62679C196F”,
“marque”: null
},
{
“categorie”: “Fruits secs”,
“___class”: “Produits”,
“bio”: true,
“fournisseur”: null,
“nom”: “Noisettes entières”,
“objectId”: “B0F1BC3E-BCAA-4D37-B8E3-7A0C5AF03AA2”,
“marque”: null
},
{
“categorie”: “Bonbons, choco”,
“___class”: “Produits”,
“bio”: false,
“fournisseur”: “Sunshine”,
“nom”: “Tablette choco lait noisettes”,
“objectId”: “C44336BB-CAE5-4ABC-B902-19161F8022CF”,
“marque”: null
}
]
}

Hope this helps.

@Maxime_Franchot

Thank you for providing the object.

To reproduce the problem, I created a TestService and returned the object you shared.


Unfortunately, I was not able to reproduce the issue, so it seems the problem might be related to the arguments. Could you please provide those as well, or alternatively, create a new app that demonstrates how to reproduce the issue?

Best regards,
Backendless Support

@sergey.kuk thank you for bringing me back to my QA Tester days.

Here is a reproducible test case on my side:

As you can see, the test service returns the error when run in FlowRunner. Maybe the difference is that I used “raw string” in the codeless builder.

The “Raw Codeless” code is as follows:

<block xmlns="http://www.w3.org/1999/xhtml" type="json_parse" id="uqTBI#%lyhYi9k,)Pa_-" x="224.0546875" y="125"><value name="text"><shadow type="text" id="4|gaSe5TkR^/,xrt?LGp"><field name="TEXT"></field></shadow><block type="raw_text" id="yn:EaZ.euVTBLNVinCeH"><field name="RAW_TEXT">{     "NOISETTE": [         {             "categorie": "Biscuits",             "___class": "Produits",             "bio": true,             "fournisseur": null,             "nom": "Cookie choco noisette sans gluten",             "objectId": "033FAB56-CD78-44D5-B559-6D8BA7A855D9",             "marque": null         },         {             "categorie": "Biscuits",             "___class": "Produits",             "bio": true,             "fournisseur": null,             "nom": "Biscuit coeur choconoisette",             "objectId": "264FB284-6B49-42D4-9C7E-C16DF4DCE7ED",             "marque": null         },         {             "categorie": "Bonbons, choco",             "___class": "Produits",             "bio": true,             "fournisseur": "Superchoc",             "nom": "Tablette chocolat noir noisette café",             "objectId": "368A4013-3D64-4F1E-AA74-0592C2825327",             "marque": null         },         {             "categorie": "Fruits secs",             "___class": "Produits",             "bio": true,             "fournisseur": null,             "nom": "Noisettes grillées",             "objectId": "9C9CAA13-7278-42A3-A2CF-AC62679C196F",             "marque": null         },         {             "categorie": "Fruits secs",             "___class": "Produits",             "bio": true,             "fournisseur": null,             "nom": "Noisettes entières",             "objectId": "B0F1BC3E-BCAA-4D37-B8E3-7A0C5AF03AA2",             "marque": null         },         {             "categorie": "Bonbons, choco",             "___class": "Produits",             "bio": false,             "fournisseur": "Sunshine",             "nom": "Tablette choco lait noisettes",             "objectId": "C44336BB-CAE5-4ABC-B902-19161F8022CF",             "marque": null         }     ],     "CHOCO": [         {             "categorie": "Biscuits",             "___class": "Produits",             "bio": true,             "fournisseur": null,             "nom": "Cookie choco noisette sans gluten",             "objectId": "033FAB56-CD78-44D5-B559-6D8BA7A855D9",             "marque": null         },         {             "categorie": "Bonbons, choco",             "___class": "Produits",             "bio": false,             "fournisseur": "Sunshine",             "nom": "Tablette choco lait amandes",             "objectId": "04B1996C-D433-49C4-ADAE-9AA6FF5CF49B",             "marque": null         },         {             "categorie": "Bonbons, choco",             "___class": "Produits",             "bio": false,             "fournisseur": "Sunshine",             "nom": "Tablette choco noir éclats",             "objectId": "0AA72226-50C5-4CB7-BD2B-C6E4693A1F8F",             "marque": null         },         {             "categorie": "Bonbons, choco",             "___class": "Produits",             "bio": true,             "fournisseur": null,             "nom": "Tablette choco lait caramel beurre salé",             "objectId": "1392C8A2-1782-43F5-B3E0-0DD4F66B9423",             "marque": null         },         {             "categorie": "Biscuits",             "___class": "Produits",             "bio": true,             "fournisseur": null,             "nom": "Biscuit coeur choconoisette",             "objectId": "264FB284-6B49-42D4-9C7E-C16DF4DCE7ED",             "marque": null         },         {             "categorie": "Bonbons, choco",             "___class": "Produits",             "bio": true,             "fournisseur": "Superchoc",             "nom": "Tablette chocolat noir noisette café",             "objectId": "368A4013-3D64-4F1E-AA74-0592C2825327",             "marque": null         },         {             "categorie": "Biscuits",             "___class": "Produits",             "bio": true,             "fournisseur": null,             "nom": "Biscuit nappé choco noir",             "objectId": "3DFE5837-4D85-4B28-B4D2-625FCB0660F5",             "marque": null         },         {             "categorie": "Bonbons, choco",             "___class": "Produits",             "bio": true,             "fournisseur": null,             "nom": "Tablette chocolat noir 88%",             "objectId": "407CF5A5-C01F-4A6C-920C-5914B7E3193F",             "marque": null         },         {             "categorie": "Biscuits",             "___class": "Produits",             "bio": true,             "fournisseur": null,             "nom": "Cookie tout choco Belledonne",             "objectId": "5C7D85F2-D19F-4E45-90C1-D6DAF45B5565",             "marque": null         },         {             "categorie": "Bonbons, choco",             "___class": "Produits",             "bio": true,             "fournisseur": null,             "nom": "Palet chocolat noir 70%",             "objectId": "7752A0E5-BCCF-4E2F-9D35-CFFF9E5CDDA8",             "marque": null         }     ],     "BISCUIT": [         {             "categorie": "Biscuits",             "___class": "Produits",             "bio": true,             "fournisseur": null,             "nom": "Biscuit coeur choconoisette",             "objectId": "264FB284-6B49-42D4-9C7E-C16DF4DCE7ED",             "marque": null         },         {             "categorie": "Biscuits",             "___class": "Produits",             "bio": true,             "fournisseur": null,             "nom": "Biscuit nappé choco noir",             "objectId": "3DFE5837-4D85-4B28-B4D2-625FCB0660F5",             "marque": null         },         {             "categorie": "Biscuits",             "___class": "Produits",             "bio": true,             "fournisseur": "Scope",             "nom": "Biscuit fruits rouges",             "objectId": "C3DA33E1-99BB-4F2D-A4F9-171A34F3AE0A",             "marque": null         },         {             "categorie": "Biscuits",             "___class": "Produits",             "bio": true,             "fournisseur": null,             "nom": "Biscuit ptit déj cacao pépites",             "objectId": "F0D24780-05A8-4B18-8937-38271F3D1128",             "marque": null         }     ],     "BIO": [],     "CŒUR": [] }</field></block></value></block>

And the request configuration is as follows:

Note the “String” return type. (Also breaks with “Object”)

Hi Maxime,

I tried to reproduce the error with the JSON value you shared and it worked for me. Here’s a video describing what I did:

Regards,
Mark

Hi @mark-piller @sergey.kuk ,

I still am able to reproduce the bug, here’s a small video showing how I’m able to do it on my side. I believe it may be related to the “Raw Text” codeless block, or at least that’s the only difference I see between my example and yours.

Hi Maxine,

Have you tried removing the block? Or it has to be there for some reason?

Mark

Hi Mark,

I am in fact not anymore using this block. Just documenting for your purposes :slight_smile:

Hope this helps,
All the best

Hi Maxime,

Are you still experiencing the error or is it gone after the block was removed?

Regards,
Mark

Hi @Maxime_Franchot

try to change the response type from “string” to “void”

Regards,
Vlad

@mark-piller
Apologies if I misunderstood your question. I’ve successfully worked around the original issue by converting the returned object to a string using the “Convert object to String” block. Therefore the error is no longer a blocker in my FlowRunner implementation.

If I instantiate either of these “Test API” blocks in FlowRunner, the error is re-created. But to answer your question, if I remove them then no, the error does not persist.

@vladimir-upirov Thank you for your response, I will see if this helps with the original issue.