Hello everyone, does anyone know how I can get information from an api response?
For example, (taking the Pokemon API) results in the following url
{
“abilities”: [
{
“ability”: {
“name”: “static”,
“url”: “https://pokeapi.co/api/v2/ability/9/”
},
How can I get the name and url data to enter it into a text field of a desktop application?
You should use the Deserialize JSON Activity, this requires downloading the UiPath.Web.Activities Package
Thanks, I have just been using it and it can now “separate” the abilities of the pokemon, but I need to extract the specific data such as the name of the ability and the url
Lets try ResultJson.SelectToken(“ability”).Item(“url”).ToString or jsToken.SelectToken(“ability”).Item(“url”).ToString
I have attached the 2 workflows as a starter which would help you to extract the data from deserialize JSON :-
JsonValueExtraction1.zip (30.8 KB)
JsonValueExtraction2.zip (27.3 KB)
Mark as solution and like it if it helps you
Happy Automation
Best Regards
Er Pratik Wavhal
@Juan_Esteban_Valencia try this-
ResultJson.SelectToken(“abilities”).item(“ability”).Item(“url”).ToString
Assuming Json text is
{
“abilities”:
{
“ability”: {
“name”: “static”,
“url”: “https://pokeapi.co/api/v2/ability/9/”
},
“is_hidden”:false,
“slot”:1
}
Edit: After looking at the url I see that “there is a 50% chance that encounters will be with an electric Pokémon, if applicable” this json command should boost you up to 100%(unconfirmed!)