1

I am using Newtonsoft JSON DLL, to Deserialize a JSON String retrieved from a URL, into a VB.NET Class object. Everything works until I get to the following JSON path:

"breadcrumbs":[
[
"ABC"
],
 "DEF",
 "GHI",
 "JKL"
],

My Class property is as follows:

Private m_breadcrumbs As List(Of List(Of String))

Public Property breadcrumbs() As List(Of List(Of String))

    Get
        Return m_breadcrumbs
    End Get

    Set(value As List(Of List(Of String)))
        m_breadcrumbs = value
    End Set

End Property

I am seeing the following exception: Error converting value "DEF" to type 'System.Collections.Generic.List1[System.String]'

My question is, what can I change in my Class object to allow it to consume this JSON structure? (NOTE: the JSON structure in the example code above is EXACTLY what is being returned in the JSON string.)

3
  • Maybe one of these can help you? Link 1 - Link 2 - Link 3 Commented Mar 8, 2016 at 21:46
  • 1
    The JSON listed is not valid (probably just incomplete); but it is also a bit odd: usually it includes something akin to key value pairs where the key become the prop name and the value the...well, value. Yours appears to be just the data. "ABC" is afloat all by itself, which the second part might be a List(of String). I am not sure how to get it out of there as such because of the lack of names. You could parse it maybe. What does "ABC" represent? Commented Mar 8, 2016 at 22:58
  • @Plutonix, thanks for taking a look. My response to the vendor was the same as yours, it doesn't seem to be properly formed with name-value pairs. Each value in the example represents data value only (no names). I'm now approaching just as you suggested via parsing... Commented Mar 11, 2016 at 4:54

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.