I’m parsing some JSON data in my code, using an “Invoke Code” block.
Here is the code I am using:
Dim resultTokens As Newtonsoft.Json.Linq.JToken = ecmResults.SelectToken("searchDocumentsResponse").SelectToken("documentsIndexInfo")
Dim resultChildren As Newtonsoft.Json.Linq.JEnumerable(Of Newtonsoft.Json.Linq.JToken) = resultTokens.Children
Dim maxDateVal As Date = Date.ParseExact("1/1/1990", "M/d/yyyy", System.Globalization.DateTimeFormatInfo.InvariantInfo)
Dim curDateVal As Date
newestDocGuid = ""
For Each rch As Newtonsoft.Json.Linq.JToken In resultChildren
Dim curGuid As String = rch.Item("guid").ToString()
Dim curObjectStore As String = rch.Item("objectStore").ToString()
Dim jtok As IEnumerable(Of Newtonsoft.Json.Linq.JToken) = rch.SelectTokens("properties")
For Each jt As Newtonsoft.Json.Linq.JToken In jtok.Children
If jt("name").ToString() = "ReceivedOn" Then
Dim curDateStr As String = jt("value").ToString()
curDateVal = Date.ParseExact(curDateStr, "M/d/yyyy", System.Globalization.DateTimeFormatInfo.InvariantInfo)
End If
If jt("name").ToString() = "Form_ID" And (jt("value").ToString() = "FORM1" Or jt("value").ToString() = "FORM2") And Date.Compare(curDateVal, maxDateVal) > 0 Then
newestDocGuid = curGuid
maxDateVal = curDateVal
newestObjectStore = curObjectStore
End If
Next
Next
This code runs correctly in Visual Studio, however when running in UiPath Studio, I receive a message “Children” is not a member of Systems.Collections.Generic.IEnumerable(Of Newtonsoft.Json.Linq.JToken) at line 15. This is double-weird since the UiPath autocomplete for the code clearly lists “Children” as one of the methods that can be used.
I’ve seen some topics on here about missing assemblies, but I’m not sure which one I would need to correct this issue. I am using UiPath 2017.1.6435
Any ideas how to correct this issue?