Hi @
I doing some tests based on the document How to serialize and deserialize (marshal and unmarshal) JSON in .NET and it works well.
Please try the following code.
Imports System.IO
Imports System.Text.Json
Imports System.Text.Json.Serialization
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim jsonString As String
Dim root As Root
jsonString = File.ReadAllText("C:\json.txt")
root = JsonSerializer.Deserialize(Of Root)(jsonString)
Console.WriteLine(root.results(0).attributes.name)
End Sub
End Class
Public Class Attributes
Public Property OBJECTID As String
Public Property featuretype As String
Public Property name As String
Public Property state As String
Public Property featurereliability As String
Public Property attributereliability As String
Public Property planimetricaccuracy As String
Public Property source As String
Public Property ufi As String
Public Property creationdate As String
Public Property retirementdate As String
Public Property pid As String
Public Property symbol As String
Public Property SHAPE As String
<JsonPropertyName("st_area(shape)")>
Public Property StAreaShape As String
<JsonPropertyName("st_perimeter(shape)")>
Public Property StPerimeterShape As String
End Class
Public Class Result
Public Property layerId As Integer
Public Property layerName As String
Public Property displayFieldName As String
Public Property value As String
Public Property attributes As Attributes
End Class
Public Class Root
Public Property results As List(Of Result)
End Class
Best Regards.
Jiachen Li
----------
If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.