说明:
五、返回结果:
1. 成功结果:查询字段FieldKeys的集合,封装的接口返回的时候 List<List<object>>
代码:
Dim ids As New List(of String)
ids = client.ExecuteBillQuery(jo.Tostring)
报错结果:
此主题相关图片如下:微信图片_20240725112240.png
Dim ids As List(of List(of Object)) = client.ExecuteBillQuery(jo.Tostring)
'------------------------------------------------------------------------------
For Each Value As List(of Object) In ids
For i As Integer = 0 To Value.Count -1
Dim j As String = Value(i).Tostring
Output.Show(j) '这里的Value(i).Tostring 如何判断是否 json 格式呢?
Next
Next
没有办法判断,直接解析,能用JObject.Parse解析的就是json 格式
问题是 返回正确数据时,就不是 json 格式,错误时就是返回 json 格式
如下:
Dim ids As List(of List(of Object)) = client.ExecuteBillQuery(jo.Tostring)
For Each Value As List(of Object) In ids
For i As Integer = 0 To Value.Count -1
Dim jk As JObject = JObject.Parse(Value(i).Tostring)
Next
Next
此主题相关图片如下:微信图片_20240725160459.png
[此贴子已经被作者于2024/7/25 16:08:18编辑过]
Try
Dim jk As JObject = JObject.Parse(Value(i).Tostring)
对json其它处理
Catch ex As Exception
MsgBox("不是 json")
不是json的其它处理
End Try