我有以下 json 字符串,并希望获取所有包含或多或少相同格式的“消息”的值。我的常用代码不起作用:
Dim jobj As JObject = JObject.Parse(data)
Dim skipFlag As Boolean = False
Dim token As JToken = JObject.Parse(data)
Dim results As List(Of JToken) = jobj.Children().ToList
For Each item As JProperty In results
item.CreateReader()
If item.Name = "error" Then
End If
Next
只返回一个值,不确定如何捕获这些值。
{"error":
{"message":
"Rule '\"CVS_Extra ' is invalid. mismatched character '<EOF>'
expecting '\"' (at position 21)\nno viable alternative at input '<EOF>'
\nRule '\"walgreens.com\" TX a prescription\" ' is invalid.
mismatched character '<EOF>' expecting '\"' (at position 45)
\nRule '\"walgreen's\" TX a prescription\" ' is invalid.
mismatched character '<EOF>' expecting '\"' (at position 42)
\nRule '\"cvs.com\" TX a prescription\" ' is invalid.
mismatched character '<EOF>' expecting '\"' (at position 39)
\nRule '\"C V S\" TX a prescription\" ' is invalid.
mismatched character '<EOF>' expecting '\"' (at position 37)
\nRule '\"H E Butt\" TX a prescription\" ' is invalid.
mismatched character '<EOF>' expecting '\"' (at position 40)
\nRule '\"H-E-B\" TX a prescription\" ' is invalid.
mismatched character '<EOF>' expecting '\"' (at position 37)
\nRule '\"HEB.com\" TX a prescription\" ' is invalid.
mismatched character '<EOF>' expecting '\"' (at position 39)
\n","sent":"2013-08-09T15:49:51+00:00"}}