mgholam / fastJSON

Smallest, fastest polymorphic JSON serializer
https://www.codeproject.com/Articles/159450/fastJSON-Smallest-Fastest-Polymorphic-JSON-Seriali
MIT License
479 stars 147 forks source link

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

Open FreeVB opened 3 years ago

FreeVB commented 3 years ago

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.

mgholam commented 3 years ago

Please post your json string.

FreeVB commented 3 years ago

json.txt The total number of records is 364.

FreeVB commented 3 years ago

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.

mgholam commented 3 years ago

Try :

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

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