Hi @Mattia Fanti ,
You can prevent this exception by adding predicates in front.
If kvp.Value("records") IsNot Nothing Then
Dim records = kvp.Value("records").AsArray
For Each r In records
Dim side As String = r("side").AsValue.ToString
Next
End If
Or use the Try Catch statement to handle this exception.
Try
Dim records = kvp.Value("records").AsArray
For Each r In records
Dim side As String = r("side").AsValue.ToString
Next
Catch ex As System.NullReferenceException
Console.WriteLine(ex.Message)
End Try
Hope this could be helpful.
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.