I use UiPath since around two weeks. With the integrated functions it works for me as user fine.
Now i have a new requirement and actually i have not a clue to solve it. May be somebody can give me some tips:
Situation:
I actually use UI Path to extract json Information from a Partner API and write it to a csv/text file (around 5mb). Works fine. I got now a request if it is possible to filter the Information since colleagues want to put that informations in a SQL database… It means to get the complete json Feedback and filterering for several 100 entrys (dynamic size) with around an dozen different informations (like Name, prize, Duration, and so one)
Idea:
I thought that i can build an loop to search the file for different key words / informations. But i did’t found an option for that.
Any tips?
I still have some Problems with the orignal Operation. The JSON part is now okay. But i have still Problems to write the extracted JSON informations to csv file.
The Export to a csv presume that the data Comes from a datatable. How can i Transfer data from the json Export to a datatable?
if you are able to extract json data if i will suppose kind of array you are getting then you can use loops with it according to datatype suitable and by using “add data row” datatable activity you can add data into a datatable and then you can write into an excel or csv.
Thanks for your Feedback.
My sequence actually Looks like:
HTTP Request (get a id)
HTTP Request with the ID ( get the json as string)
Deserialize Json (string) as Json object
For each Loop
Write it to line as string
That is working so far (if i filter that everything will be exported). If i Change the filtering to dífferent types i got an error that there are different datatypes in the Array (string, int32 and so on). Think here is the first understanding Problem from me.
I tried to Change the step 3 to a json Array deserialization but than i receive an exeption that the json string is not an array (that isn’t true, that is an JasonArray). So i changed it deserialize json and deserialze it. Is that the reason why i can not Transfer the data to a datatable?
HI,
I deserialized my JSON file.But I’m getting the following error. I don’ know why am I getting this…?
“Error reading JObject from JsonReader. Current JsonReader item is not an object: StartArray. Path ‘’, line 1, position 1.” Can anyone help me to solve this.
@Senthilkumar55
JSON array must start with square brackets"[" and should end with “]”, your JSON array might be wrapped up in another JSON object which is not an array, for eg.
This is correct:
[{“number”:“INC0355531”,“incident_state”:“Pending Change”},{“number”:“INC0325709”,“incident_state”:“Pending Third Party”},{“number”:“INC0355477”,“incident_state”:“Pending Change”},{“number”:“INC0194842”,“incident_state”:“Pending Third Party”}]
This is incorrect:
{“result”:[{“number”:“INC0355531”,“incident_state”:“Pending Change”},{“number”:“INC0325709”,“incident_state”:“Pending Third Party”},{“number”:“INC0355477”,“incident_state”:“Pending Change”},{“number”:“INC0194842”,“incident_state”:“Pending Third Party”}]}
Don’t use deserialise,
Create new variable and parse string
JObject works when we use variable name “jobject” and variable type jobject with Default value to “new jobject”
Can you please tell me how to convert
{“result”:[{“number”:“INC0355531”,“incident_state”:“Pending Change”},{“number”:“INC0325709”,“incident_state”:“Pending Third Party”},{“number”:“INC0355477”,“incident_state”:“Pending Change”},{“number”:“INC0194842”,“incident_state”:“Pending Third Party”}]}
to
[{“number”:“INC0355531”,“incident_state”:“Pending Change”},{“number”:“INC0325709”,“incident_state”:“Pending Third Party”},{“number”:“INC0355477”,“incident_state”:“Pending Change”},{“number”:“INC0194842”,“incident_state”:“Pending Third Party”}]
I am also facing similar issue, I want to remove {“result”: part. Can someone please guide me on this.