vb.netjsonnode

Need jsonNode.parse to do a case insensitive match in VB.Net


I can successfully parse the specific JSON data from a JSON file. The issue is that the file I am parsing is inconsistant with the letter case. So I need to do a case insensitive match instead of the default case sensitive match. I Google search this and it appears to be possible, but none of the examples are for jsonNode.Parse. Here is my code so far.

Using reader As New StreamReader(ext_manifest)
    Do Until reader.EndOfStream
        node_data = reader.ReadToEnd
    Loop
End Using

           
Dim node As JsonNode = JsonNode.Parse(node_data)
first_name = node("name").ToString
msgbox(first_name)

This gets results as long as the word casing I specify matches the one in the file. However, the word case seems to inconsistant in the file itself


Solution

  • I just converted jsonNode result to lower case and now it does not matter what case the key name is in.

    Using reader As New StreamReader(ext_manifest)
        Do Until reader.EndOfStream
            node_data = reader.ReadToEnd
        Loop
    End Using
    
           
    Dim node As JsonNode = JsonNode.Parse(node_data.tolower)
    first_name = node("name").ToString
    msgbox(first_name)