Solved

Reading a JSON (Serialize) Data

Posted on 2013-01-14
4
334 Views
Last Modified: 2013-01-14
Hi Folks,

I have the following json data

{"CTS":"0,51,52","lastTopic":53,"questions_answered":["3","2","4","1","9"],"scoreArray":[],"06_01":20}

Open in new window


How do I read scoreArray value of 20 which is the last value in Javascript

Thanks

RG
0
Comment
Question by:rgarimella
  • 2
  • 2
4 Comments
 
LVL 82

Expert Comment

by:leakim971
ID: 38776662
for example : http://jsfiddle.net/tb2MF/
var j = {
    "CTS": "0,51,52",
    "lastTopic": 53,
    "questions_answered": [
        "3",
        "2",
        "4",
        "1",
        "9"
    ],
    "scoreArray": [4,5,6,8,1,2,9,3,0,4,5,6,8,1,2,9,3,0],
    "06_01": 20
}

for(v=0;v<j.scoreArray.length;v++) {
  alert(j.scoreArray[v]);
}

Open in new window

0
 

Author Comment

by:rgarimella
ID: 38776717
Thanks, but this code does not read the value of "06_01": 20

All I need is the value stored in 06_01
0
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
ID: 38776727
Use : j["06_01"]
Test page : http://jsfiddle.net/tb2MF/2/
0
 

Author Comment

by:rgarimella
ID: 38776825
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

PROBLEM: The other day I was working on adding an ajax request to a webpage that already had a dialog box on the page.  The dialog box was using relative positioning to be positioned next to a form field I had on the page.  Everything was working…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now