Solved

Reading a JSON (Serialize) Data

Posted on 2013-01-14
4
341 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

OverviewThis article demonstrates a simple search form using AJAX. The purpose of the article is to demonstrate how to use the same code to render a page and javascript (JQuery) and AJAX to make subsequent calls to refine the results. The princip…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. 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.: (CODE)
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…

752 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