How to edit feilds in a yml file

Hi,

I am new to UiPath, A trying to edit yml file to deploy software.

Can anyone help me with how to edit yml file?

Hello @suvarnalaxmi

Welcome to UiPath community ! Please clarify you question, we will do our best to help you !

Hi @mz3bel

Thanks for the reply.

SECRET_TOKEN: “d4e5783de1c74c7a4e3a27578df6gdgf6g786g8df7g6g87d6fgb709”
FACEBOOK_APP_ID: “35864341”
FACEBOOK_APP_SECRET: “759a1e7sd7fvyfsd473”
TWITTER_CONSUMER_KEY: “1UrRKJDF8SD7FSDF3S”
TWITTER_CONSUMER_SECRET: “5W7TE8KJJk787bnG0s”
TWITTER_OAUTH_TOKEN: “716397744-3rHXFkFkjKjkjK78PQ5”
TWITTER_OAUTH_TOKEN_SECRET: “DuDJKFSD89SDFD”
LINKEDIN_API_KEY: “2vjkJKjk4”
LINKEDIN_SECRET_KEY: “5KLSJDFsE”
GMAIL_USERNAME: “username@gmail.com
GMAIL_PASSWORD: “PASSWORD”
AWS_ACCESS_KEY_ID: “ASDKLSDJFIA”
AWS_SECRET_ACCESS_KEY: “7ASDFJksdfjskdlf87sdfKb”
AWS_S3_BUCKET: “bucket”

development:
MAILER_HOST: “localhost:3000”

Above mentioned is my yml file and I need to modify some of the fields in that file like

GMAIL_USERNAME: “Abcd@gmail.com
GMAIL_PASSWORD: “xyz@123”

How can I modify them?

Thanks in Advance!

1 Like

Hey, first you have to deserialize the whole content using :

var deserializer = new YamlDotNet.Serialization.Deserializer();
var result = deserializer.Deserialize<List<Hashtable>>(new StringReader(yaml_content_as_string));

Then you can find the element that you want to edit, to do it just loop through the element with a if to check the “GMAIL_USERNAME” and “GMAIL_PASSWORD” key. and edit their value.
After what you have to serialize the object to a you yaml format using :

var serializer = new YamlDotNet.Serialization.Serializer();

Good luck :slight_smile:

1 Like

@suvarnalaxmi

Check below example :point_down:

Note * for randam data, use regex.

upDateYMLFILE.xaml (4.8 KB)

Let me know if it works :slight_smile:

1 Like

Get the https://www.nuget.org/packages/YamlDotNet/ nuget package.
Then install it using packet manager on your uipath project.
Then go to Imports, and import YamlDotNet.Serialization.
Then you will be able to use this library to deserialize and serialize your file.

You can proceed using a Invoke code :
image
And my result :
image

1 Like

hi @Damien iam new to how to use yaml my requirement is i need to read yaml and use the data in process yaml should work as dictionary for me how can i achieve that