cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic variables for the JSON

AnuraagPandey
Level 4
Hello,

I am working on a project where I am fetching attachment from email and a few sender details.

Now, the next step involves converting this information into JSON, these details would be dynamic as new emails come in from different individuals.

The values inside this JSON has to be made dynamic. 
Would really appreciate any pointers.

json = {"variables":
{
"Name": {"value": "XYZ", "type": "string"},
"Employeemail": {"value": "XYZ@rpaisthebest.com", "type": "string"},
"fileType": {"value": "pdf", "type": "string"},
"Employeefilename":{"value": "thisisafile.pdf", "type": "string"},
"file": {"value": pdffile.decode('utf-8'), "type": "file",
"valueInfo": {"filename": "thisisafile.pdf", "mimetype": "application/pdf", "encoding": "UTF-8"
}}}


Regards

------------------------------
Anuraag Pandey
------------------------------
1 REPLY 1

ErinConnerley
Level 4
You should be able to use the Utility - JSON object and do a Collection to JSON action call. If that isn't capable of handling the complexity you need it to then copy / save as on the original Utility - JSON object and create a Utility - JSON - Extended object and extend the code stages and actions within to handle json accordingly. newtonsoft and/or json.net are both very friendly to work with and very flexible and powerful so you should be able to do just about anything you need to do. In the long run this is the most scalable solution and reusable solution. Alternatively, you could use simple text manipulation with replaces on your own defined variables inside the json structure above but honestly that isn't very scalable or reusable in other places.

------------------------------
Erin Connerley
Automation Consultant
Agilify Automation
America/Indiana/Indianapolis
------------------------------