473,326 Members | 2,061 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Looping Through JSON Response

116 64KB
Hi,

I am getting data from a web service. This is no problem. The returned JSON data is, say, as follows.

[
{
"jsonrpc":"2.0",
"result":[
{
"playerData":{
"number":"7",
"name":"Ronaldo"
},
"teamName":"Real Madrid"
},
{
"playerData":{
"number":"10",
"name":"Messi"
},
"teamName":"Barcelona"
}
],
"id":1
}
]

I am then deserializing it with the following line.

Expand|Select|Wrap|Line Numbers
  1. Dim playerresp = JsonConvert.DeserializeObject(Of Result)(responseFromServer)
  2.  
I have classes set up for playerData, teamName, number and name.

I know that what I need is like playerresp.playerData.name etc

But how do I loop through the players listed? Ie, so I can write them as

Real Madrid: Ronaldo (7)
Barcelona: Messi (10)


This is no doubt fairly straightforward but I'm struggling with the simple part having done the hard part....
Jan 30 '14 #1

✓ answered by robertybob

Ok I just removed the leading and trailing [ from the response before Deserializing and can get some data. Doesn't seem to be another way to do this so will suffice.

2 3279
robertybob
116 64KB
Obviously not straightforward then...... no-one knows how to loop through a JSON response?
Jan 31 '14 #2
robertybob
116 64KB
Ok I just removed the leading and trailing [ from the response before Deserializing and can get some data. Doesn't seem to be another way to do this so will suffice.
Jan 31 '14 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Marc | last post by:
I'm aware that there are significant differences between VBScript objects and JScript objects but that doesn't mean something like the following should give me such troubles? <%@...
4
by: Amuthaangler | last post by:
Hi all, I am currently working with Iframe which holds the JSON response from the server once when the picture gets uploaded successfully. Now I need to parse the JSON response and retrieve...
5
by: buntyindia | last post by:
//Outputs: Hi , I am making a application in which I have to send a request using Ajax to ther server and the server return response in JSON . I just wanna know i am getting the following...
1
by: MichaMicha | last post by:
Hi, I'm experiencing some problems when I get a huge Json response. Is there a way to increase the maximum size of a response?
1
by: Jeff | last post by:
I'm writing my first json/ajax code and I'm having a hard time wrapping my mind around security issues. I'm thinking of a json response that would look like this: {"data":}...
5
dmjpro
by: dmjpro | last post by:
Recently I came to know that ..... it's better to to generate some JSON instead of plain HTML when i am calling AJAX. But today i read that the usage of eval is dangerous while i processing the AJAX...
3
Kelicula
by: Kelicula | last post by:
Hi all, I am usually a Perl programmer, I have some background in javascript and am attempting to create a Googleish selector div. Please bear with me, excuse the long introduction... Here's...
9
ssnaik84
by: ssnaik84 | last post by:
Hello, I am trying to integrate FlexBox It uses JSON data to populate listbox items. It internally calls a server side page with AJAX, and reads the JSON results from that page. for example,...
5
by: najmi | last post by:
hai.. i hava use FullCalendar in my application.i try to reload event into the calendar but it doesn`t work.here is my code <%@ page import="java.util.HashMap;" %> <%@ page...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.