I am having touble parsing Json using VB.NET using the Newtonsoft Json.Net library
Json Data
---------
{
\"CC\": \"sample.cc@emailDomain.
I'm no expert on the Linq to JSON implementation in JSON.Net, but this worked for me.
You're pretty much all the way there. All you need to do is drill down a little further in the object model.
Dim results As List(Of JToken) = o.Children().ToList
For Each item As JProperty In results
item.CreateReader()
Select Case item.Name
Case "CC"
Dim strCC = item.Value.ToString
Case "CcFull"
Dim strEmail As String
Dim strName As String
For Each subitem As JObject In item.Values
strEmail = subitem("Email")
strName = subitem("Name")
Next
End Select
Next
The item that you get from the results list has sub-items, as you noted. That sub item has a series of values - the array denoted by the brackets in your JSON string. That Values
method is an IEnumerable so we can iterate over it, receiving a JObject from each iteration. That object represents a single entry in the CcFull array. You can then use the property name as an index to retrieve the value for that property.