fastJSON icon indicating copy to clipboard operation
fastJSON copied to clipboard

How does the JSON.Parse(json) function get the total number of records returned?

Open FreeVB opened this issue 3 years ago • 5 comments

How to get the total number of records returned by using the JSON.Parse(json) function? I use JSON.Parse(json).count to return only the number 5, which actually has 364 records.

FreeVB avatar Mar 08 '21 07:03 FreeVB

Please post your json string.

mgholam avatar Mar 08 '21 07:03 mgholam

json.txt The total number of records is 364.

FreeVB avatar Mar 08 '21 07:03 FreeVB

Dim sJson As String = IO.File.ReadAllText("..\..\json.txt") Try For i As Long = 0 To JSON.Parse(sJson).count TextBox2.Text += vbCrLf & JSON.Parse(sJson)("data")(i)("bond_nm").ToString 'textBox1.Text Next i Catch ex As Exception MsgBox(ex.Message) End Try I got it this way.

FreeVB avatar Mar 08 '21 07:03 FreeVB

Try :

( JSON.Parse(sJson) as Dictionary<string, object>) ["data"].Count // in c#

mgholam avatar Mar 08 '21 07:03 mgholam

Thank you, mgholam! It turned out that my method was wrong.

FreeVB avatar Mar 08 '21 07:03 FreeVB