I have the exact same issue as what's in this question
I was able to get the code to work in C#, however I'm writing my program in Visual Basic. I ran the code through a converter and got this :
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim html As String = String.Empty
Dim url As String = "https://crm.zoho.com/crm/private/json/Contacts/searchRecords?authtoken=0e0dd5f8153bc0a1299766b32d09e4f7&&scope=crmapi&fromIndex=1&toIndex=200&criteria=(Store:3110)"
Dim request As HttpWebRequest = DirectCast(WebRequest.Create(url), HttpWebRequest)
request.AutomaticDecompression = DecompressionMethods.GZip
Using response As HttpWebResponse = DirectCast(request.GetResponse(), HttpWebResponse)
Using stream As Stream = response.GetResponseStream()
Using reader As New StreamReader(stream)
html = reader.ReadToEnd()
End Using
End Using
End Using
Dim loContactList As New List(Of Contact)()
Dim loContact As Contact = Nothing
Dim respone As ResponseActual = JsonConvert.DeserializeObject(Of ResponseActual)(html)
For Each row var In respone.Response.Result.Contacts.Row
loContact = New Contact()
Dim rowItem = row.FL.ToList()
Try
loContact.ContactID = rowItem.Where(Of FL)(Function(s, t) s.Val = "CONTACTID").[Select](Function(x) x.Content).[Single]()
Catch
End Try
Try
loContact.OwnerID = rowItem.Where(Of FL)(Function(s, t) s.Val = "SMOWNERID").[Select](Function(x) x.Content).[Single]()
Catch
End Try
Try
loContact.ContactOwner = rowItem.Where(Of FL)(Function(s, t) s.Val = "Contact Owner").[Select](Function(x) x.Content).[Single]()
Catch
End Try
Try
loContact.FirstName = rowItem.Where(Of FL)(Function(s, t) s.Val = "First Name").[Select](Function(x) x.Content).[Single]()
Catch
End Try
Try
loContact.LastName = rowItem.Where(Of FL)(Function(s, t) s.Val = "Last Name").[Select](Function(x) x.Content).[Single]()
Catch
End Try
Try
loContact.Email = rowItem.Where(Of FL)(Function(s, t) s.Val = "Email").[Select](Function(x) x.Content).[Single]()
Catch
End Try
Try
loContact.CreatorID = rowItem.Where(Of FL)(Function(s, t) s.Val = "SMCREATORID").[Select](Function(x) x.Content).[Single]()
Catch
End Try
Try
loContact.CreatedBy = rowItem.Where(Of FL)(Function(s, t) s.Val = "Created By").[Select](Function(x) x.Content).[Single]()
Catch
End Try
Try
loContact.ModifiedByID = rowItem.Where(Of FL)(Function(s, t) s.Val = "MODIFIEDBY").[Select](Function(x) x.Content).[Single]()
Catch
End Try
Try
loContact.ModifiedBy = rowItem.Where(Of FL)(Function(s, t) s.Val = "Modified By").[Select](Function(x) x.Content).[Single]()
Catch
End Try
Try
loContact.CreatedTime = Convert.ToDateTime(rowItem.Where(Of FL)(Function(s, t) s.Val = "Created Time").[Select](Function(x) x.Content).[Single]())
Catch
End Try
Try
loContact.ModifiedTime = Convert.ToDateTime(rowItem.Where(Of FL)(Function(s, t) s.Val = "Modified Time").[Select](Function(x) x.Content).[Single]())
Catch
End Try
Try
loContact.LastActivityTime = Convert.ToDateTime(rowItem.Where(Of FL)(Function(s, t) s.Val = "Last Activity Time").[Select](Function(x) x.Content).[Single]())
Catch
End Try
ListBox1.Items.Add(loContact.FirstName + " " + loContact.LastName)
loContactList.Add(loContact)
Next
End Sub
End Class
Public Class Contact
<JsonProperty(PropertyName:="CONTACTID")>
Public Property ContactID() As String
Get
Return m_ContactID
End Get
Set
m_ContactID = Value
End Set
End Property
Private m_ContactID As String
<JsonProperty(PropertyName:="SMOWNERID")>
Public Property OwnerID() As String
Get
Return m_OwnerID
End Get
Set
m_OwnerID = Value
End Set
End Property
Private m_OwnerID As String
<JsonProperty(PropertyName:="Contact Owner")>
Public Property ContactOwner() As String
Get
Return m_ContactOwner
End Get
Set
m_ContactOwner = Value
End Set
End Property
Private m_ContactOwner As String
<JsonProperty(PropertyName:="First Name")>
Public Property FirstName() As String
Get
Return m_FirstName
End Get
Set
m_FirstName = Value
End Set
End Property
Private m_FirstName As String
<JsonProperty(PropertyName:="Last Name")>
Public Property LastName() As String
Get
Return m_LastName
End Get
Set
m_LastName = Value
End Set
End Property
Private m_LastName As String
<JsonProperty(PropertyName:="Email")>
Public Property Email() As String
Get
Return m_Email
End Get
Set
m_Email = Value
End Set
End Property
Private m_Email As String
<JsonProperty(PropertyName:="SMCREATORID")>
Public Property CreatorID() As String
Get
Return m_CreatorID
End Get
Set
m_CreatorID = Value
End Set
End Property
Private m_CreatorID As String
<JsonProperty(PropertyName:="Created By")>
Public Property CreatedBy() As String
Get
Return m_CreatedBy
End Get
Set
m_CreatedBy = Value
End Set
End Property
Private m_CreatedBy As String
<JsonProperty(PropertyName:="MODIFIEDBY")>
Public Property ModifiedByID() As String
Get
Return m_ModifiedByID
End Get
Set
m_ModifiedByID = Value
End Set
End Property
Private m_ModifiedByID As String
<JsonProperty(PropertyName:="Modified By")>
Public Property ModifiedBy() As String
Get
Return m_ModifiedBy
End Get
Set
m_ModifiedBy = Value
End Set
End Property
Private m_ModifiedBy As String
<JsonProperty(PropertyName:="Created Time")>
Public Property CreatedTime() As DateTime
Get
Return m_CreatedTime
End Get
Set
m_CreatedTime = Value
End Set
End Property
Private m_CreatedTime As DateTime
<JsonProperty(PropertyName:="Modified Time")>
Public Property ModifiedTime() As DateTime
Get
Return m_ModifiedTime
End Get
Set
m_ModifiedTime = Value
End Set
End Property
Private m_ModifiedTime As DateTime
<JsonProperty(PropertyName:="Last Activity Time")>
Public Property LastActivityTime() As DateTime
Get
Return m_LastActivityTime
End Get
Set
m_LastActivityTime = Value
End Set
End Property
Private m_LastActivityTime As DateTime
End Class
Public Class ResponseActual
<JsonProperty("response")>
Public Property Response() As Response2
Get
Return m_Response
End Get
Set
m_Response = Value
End Set
End Property
Private m_Response As Response2
End Class
Public Class Response2
<JsonProperty("result")>
Public Property Result() As Result
Get
Return m_Result
End Get
Set
m_Result = Value
End Set
End Property
Private m_Result As Result
<JsonProperty("uri")>
Public Property Uri() As String
Get
Return m_Uri
End Get
Set
m_Uri = Value
End Set
End Property
Private m_Uri As String
End Class
Public Class Result
<JsonProperty("Contacts")>
Public Property Contacts() As Contacts
Get
Return m_Contacts
End Get
Set
m_Contacts = Value
End Set
End Property
Private m_Contacts As Contacts
End Class
Public Class Contacts
<JsonProperty("row")>
Public Property Row() As IList(Of Row)
Get
Return m_Row
End Get
Set
m_Row = Value
End Set
End Property
Private m_Row As IList(Of Row)
End Class
Public Class Row
<JsonProperty("no")>
Public Property No() As String
Get
Return m_No
End Get
Set
m_No = Value
End Set
End Property
Private m_No As String
<JsonProperty("FL")>
Public Property FL() As IList(Of FL)
Get
Return m_FL
End Get
Set
m_FL = Value
End Set
End Property
Private m_FL As IList(Of FL)
End Class
Public Class FL
<JsonProperty("content")>
Public Property Content() As String
Get
Return m_Content
End Get
Set
m_Content = Value
End Set
End Property
Private m_Content As String
<JsonProperty("val")>
Public Property Val() As String
Get
Return m_Val
End Get
Set
m_Val = Value
End Set
End Property
Private m_Val As String
End Class
I'm getting stuck on this line : For Each row var In respone.Response.Result.Contacts.Row
I know I can't have the var in there from C# but I can't figure out how to make this work.