How to get data after ( " : " )?

Result = {“sfiyat_fiyati”:222}

The type of result is string but it comes like Json :thinking:

Can i use split ? If i can how come ??

I only need numbers after (" : ")

hey @170290064
you can use:

  1. Assign: splitResult = Result.Split(":"c)
  2. Assign: numberAsString = splitResult(1).Trim(New Char() { "}"c, " "c })
  3. Assign: finalNumber = Convert.ToInt32(numberAsString)

or

  1. Deserialize JSON Activity:
  • JsonString: Your JSON string variable (e.g., Result).
  • Result: A new variable of type JObject (e.g., jsonObject).
  1. Assign Activity (to extract the value):
  • To: extractedValue (an integer variable to store the extracted number).
  • Value: CInt(jsonObject("sfiyat_fiyati").ToString)
1 Like

@170290064

Here you go

Here’s how you can do it step by step:

  1. Use the Deserialize JSON activity:
  • Drag and drop the “Deserialize JSON” activity onto your workflow.
  • In the properties panel, set the Input property to your JSON string ({"sfiyat_fiyati":222}).
  • Create a variable to store the deserialized output, let’s call it jsonObject.
  1. Access the value:
  • Use an Assign activity or any appropriate activity to extract the value associated with the key sfiyat_fiyati.
  • For example, you can use jsonObject("sfiyat_fiyati").ToString to get the value 222 as a string.

Thanks,
Ashok :slight_smile:

1 Like

The RPA product that i am using doesn’t have Deserialize JSON activity. So that why i am looking for a way to solve it.

But it has code editor. How can i do it i do not know.

You can deserialize the JSON string to a JObject.

image

1 Like

The RPA product that i am using doesn’t have Deserialize JSON activity. So that why i am looking for a way to solve it.

But it has code editor. How can i do it i do not know.

Are you allowed to install packages? If yes, you can install it from Manage Packages. Search for the package UiPath.WebAPI.Activities.

image

1 Like

That’s the problem. I am not using UiPath RPA. I am using local RPA.

Thats why i need help :robot:

If you are not using UiPath Studio, it would be helpful for us to know what tool and what programming language you are using.

1 Like

As it is JSON we can do directly like:
grafik

1 Like

In that case here you go. It’s lengthy but you are open to optimize it.

JsonSplit.xaml (10.4 KB)

Thanks,
Ashok :slight_smile:

1 Like

image

I used code editor in the RPA Program but i am getting some kinda error

Shameless plug of the new Deserialize JSON feature that produces an object out of a sample JSON to make this easier :slight_smile:

It works like this, during design time:

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.