cancel
Showing results for 
Search instead for 
Did you mean: 

"Utility - JSON::JsonPath - Return Collection" throwing error

Cuckoo
Level 3

Hello Community members,

Help required in parsing the JSON file and trying to extract the values using JSON path.

Tried to extract using "Utility - JSON::JsonPath". It works fine. But for returning a collection something went wrong.

In "Utility - JSON::JsonPath - Return Collection" I'm getting the following error:

Exception thrown --> "Internal : Could not execute code stage because exception thrown by code stage: Unable to cast object of type 'System.String' to type 'System.Data.DataTable'."

JSON for parsing:

{
   "Vegitables":[
      {
         "Code":"VEG54454",
         "Weight":"1KG",
         "Price":"25/-",
         "Name":"Redcabbage"
      },
      {
         "Code":"VEG46278",
         "Weight":"1KG",
         "Price":"10/-",
         "Name":"Spanich"
      },
      {
         "Code":"VEG62312",
         "Weight":"1KG",
         "Price":"40/- ",
         "Name":"Capiscum"
      }
   ]
}

I/P tab details in Utility - JSON::JsonPath - Return Collection:

---------------------------------------------------------------------------------

Cuckoo_0-1729070416574.png

O/P tab details in Utility - JSON::JsonPath - Return Collection:

----------------------------------------------------------------------------------

Cuckoo_1-1729070459820.png

Thanks in Advance,

Cuckoo George

2 REPLIES 2

Hi @Cuckoo 

The code is unable to find the value in the json. when it try to identify the names it is returned as empty value and eventually it tried to create a collection from the empty value that is teh root cause of exception.

YOu need to make sure your json  structure and name of the json property is accurate

-----------------------
If I answered your query. Please mark it as the Best Answer

Harish Mogulluri

GeoffHirst
Staff
Staff

Hi @Cuckoo,

Thank you for being a SS&C Blue Prism customer, and for using Blue Prism. From what I can tell, you are trying to search the array and return a name value pair. V10.0.1 of the asset doesn't support this, however I have been working on 10.0.2 which resolves this issue and provides the outcome you require. Thank you for bringing this shortfall to our attention and I hope the new revision will resolve your issues.

Thanks again for using Blue Prism and for your interest in the Json Asset.

regards

Geoff Hirst Senior DX Engineer - Digital Exchange - EMEA SS&C Blue Prism