Please help for JSon String / Array converter

Hi Everyone,

I want to create a dynamic function where I can fetch the value and name from the Json and can send it to the queue from where I can upload that data into my website.
The thing is, it is working well. Where for the specific json structure I have used 4 loops. But if any other child of child values come then anyhow I have to create the other loop for getting Values from that jsonobject. So it would be like JsonObject.Properties. I verify if JsonObject contains children or not if yes then again I make the same loop of properties.

So I have a question like, what if tomorrow I have a format where itr contains child of child values so again do I have to create the next loop? Any idea how I work on it ? If Do while can help? If yes then how ? Because Do while is also not working for specific content.

Regards,
Hemal

Can someone please please help !

Can we use linq ? still I am not getting the perfect output :frowning:

@Vikas.Jain
@ddpadil
can you please help

@hemal Does your json have Json Array in it? May be https://connect.uipath.com/marketplace/components/json-jarray-conversion-activities
is useful for you. Do let me know if it helps or not?

1 Like

@RahulAggarwal,

Thank You so much. But my query is like, i don’t wanted ready code. Because my format gets change everytime. So i wanted to create a dynamic function myself so that if tomorrow any error comes then i can change my code but i can’t change that activity code.

Regards,
Hemal

Yes Json Array is there. But I have already made the function but i need just minor help. If Jsonobject.children is there then again i am creating a next loop for the partcular json value. So it is not valid for creating inner loop multiple times. Can you give me some suggestions ?

Regards,
Hemal

@hemal Can you give me an example what kind of format changes will be there so that I can have a better understanding of your requirement? Even if your Json’s internal structure is changed (like you said 4 loops), this custom activity will work. Only requirement is input Json’s main node object is of type JArray, because creating DataTable and feeding queue only makes sense if your Json is iteratable. In case you want internal values from a particular JArray element then you can pass that node or sub-node in the same custom activity and get DataTable out of it. Does that answer your question? Let me know your thoughts on this.

Hello Hemal,
In this video I do a lot of stuff with JSON (Chapter included) :

0:45 Install Deserialize JSON
1:10 Present all types of JSON that will use
1:35 Deserialize simple JSON
2:50 Deserialize a JSON with an Object inside
3:55 Deserialize a JSON with Array inside
6:00 When we use Deserialize JSON Array activity
7:00 Deserialize a JSON with a List of Strings inside
9:45 Create a simple JSON
11:05 Create a JSON with an Object inside
12:17 Create a JSON with Array inside
14:05 Create a JSON with a List of Strings inside
15:55 Datatable to JSON
17:50 JSON to Datatable

Thanks,
Cristian Negulescu