I have inherited some code which uses JSON about which I know next to nothing
The code I have has identified some ‘field names’ from the deserialised data and assigned their values to variables; however, I need to know/understand what all the ‘field names’ are in this data as I need to work with other ‘field names’.
Is there a way I can obtain all the ‘field names’ as this will then enable me to obtain the values assigned to these for me to work with.
When you use the Deserialize JSON activity, it outputs an object of type JsonObject. You can see this in the Properties panel once you have clicked on the activity. The official documentation for the JsonObject class is here: JsonObject Class (System.Json) | Microsoft Learn. It seems the JsonObject is just a collection of key-value pairs. There are some Properties there to retrieve the keys and values and you can iterate through each and write them out.
There are many ways to achieve this. To avoid duplication, I would suggest you refer this thread. It shows you how to iterate through JsonObject in UiPath.
Alas the trouble is I have inherited code and know little about JSON programming
All I have is that the Deserialised JSON has been passed to a variable of type JsonObject and I need to get the available ‘field names’ and values from this variable, but do not know how
Alas the trouble is I have inherited code and know little about JSON programming
All I have is that the Deserialised JSON has been passed to a variable of type JsonObject and I need to get the available ‘field names’ and values from this variable, but do not know how
Hi,
Deserialize the Json tring and supply a variable(assume variable is “Out_jsonData”) to output and drag a message box activity and pass- Out_JsonData.SelectToken(“field names”) to check.