Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
FreeVB opened this issue Mar 8, 2021 · 5 comments

Comments

@FreeVB
Copy link

FreeVB commented Mar 8, 2021

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
Copy link
Owner

mgholam commented Mar 8, 2021

Please post your json string.

@FreeVB
Copy link
Author

FreeVB commented Mar 8, 2021

json.txt
The total number of records is 364.

@FreeVB
Copy link
Author

FreeVB commented Mar 8, 2021

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
Copy link
Owner

mgholam commented Mar 8, 2021

Try :

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

@FreeVB
Copy link
Author

FreeVB commented Mar 8, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants