Convert python dict

My python script is returning dict values.
In uipath get python Object what must be the type argument

@KarthikBallary Can you share the workflow?

pyfile

The type argument is whatever variable type you are passing to the Python script itself. in your case it is the loc variable which is likely a string.

what is returned is whatever your Python scripts says at the Return line.

you can see in your code columnlist is a dict {} variable and is returned.

works correctly.

pyFile2

passing argument is string only but return must be dict

pyFile3

it throws error in converting python object

your type argument is set to generic. can you try it with a string instead?

No It will throw error

what is the error?

Python Object cannot be converted

Doing some reading, there may be an issue returning certain datatypes in Python to UiPath as it requires a .NET object type. It seems that string variables do not have this issue however.

Can you test your py script and workflow first by trying to return a test string variable first? Just to ensure that it is indeed the issue

@KarthikBallary
You can do as follows:

import json
jsonString = json.dumps(yourdict) #dict to jsonstr
return jsonString

Then deserialization jsonString to dictionary in UiPath (UiPath.Web.Activities)

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.