Excel Config to Json Config

Hi All,
I need to convert my config file from ReFramework into Json File. Can anyone help me how to convert all the sheets (Settings, Constants, Assets) into Json ? and how can that json file be used in reframework?

Thanks in advance!

Here are all the sheets converted to JSON: JSONConfig.json (962 Bytes)

You can use the UiPath.Web.Acitivities Package to deserialize it into a JObject and access the key/value pairs very similarly to that of the Dictionary<Of String, Object> in the ReFramework. You will need to go through the different workflows and change the argument types of the config and alter the calls to the config variable slightly as well.

If I remember correctly you should be able to do Config("Assets")("Asset1").ToString (See attached file for reference) in order to access the value stored within the given key.

I would however suggest modifying your JSON file to your liking. I personally build out a Config with GLOBAL, LOCAL, DEV, STAGE, and PROD and have a companion deserializing task that detects the runtime environment and then only parses the portions of the JSON that apply. So when I run in DEV I will only parse GLOBAL and DEV. LOCAL/DEV/STAGE/PROD should all have the same elements within them, it just helps you prevent any inline configuration coding.

1 Like

Thanks Mike for the reply but can you provide me an example of xaml code. How that config.json file can be used in ReFramework?

Sorry for the late response… But hopefully this should help if you haven’t gotten it sorted out at this point.

You’ll have to rework the Init state of the process and change the Config Object from type Dictionary<String, Object> to type Newtonsoft.Json.Linq.JObject.

The following .xaml has the basics of what you’ll need to do, the config is stored in “…\Data\Config.json” and looks like this:

{
  "env":"",
  "GLOBAL":{
    "OrchestratorQueueName":"XYZQueue",
    "WebAppCredentialAsset":"XYZCredential",

    "Setting1":"XYZ1",
    "Setting2":"XYZ2",
    "Setting3":"XYZ3",
  },
  "LOCAL":{
    "FilePath":"XYZ_Local",
    "DirectoryPath":"DIR_Local",
  },
  "DEV":{
    "FilePath":"XYZ_Dev",
    "DirectoryPath":"DIR_Dev",
  },
  "STAGE":{
    "FilePath":"XYZ_Stage",
    "DirectoryPath":"DIR_Stage",
  },
  "PROD":{
    "FilePath":"XYZ_Prod",
    "DirectoryPath":"DIR_Prod",
  }
}

I’ve left annotations within the workflows that you can view to help you out as well. Patterning off of this, you can then convert the ReFramework to a JSON Config format and then you can save it as a template to use in future projects.

Example Workflow (Not in ReFramework/State Machine Format): JSONConfigExample.zip (7.3 KB)