Solved

Json Multi-Array

Posted on 2013-10-22
2
336 Views
Last Modified: 2013-10-22
I have the below string which I belive is correct for a multi-array string.

var chartData = { "Name":  [{ country: "United States", visits: 9252 }, { country: "China", visits: 1882 }], "Name2": [{ country: "Japan", visits: 1809 }, { country: "Germany", visits: 1322 }, { country: "United Kingdom", visits: 1122 } ]};

Open in new window


Now that the above is done how do I break out the array I need ie Name2?
0
Comment
Question by:crundle32
2 Comments
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
ID: 39592964
Test page : http://jsfiddle.net/6x2e5/

var chartData = { "Name":  [{ country: "United States", visits: 9252 }, { country: "China", visits: 1882 }], "Name2": [{ country: "Japan", visits: 1809 }, { country: "Germany", visits: 1322 }, { country: "United Kingdom", visits: 1122 } ]};
var array_Name2 = chartData.Name2;
alert('there is ' + array_Name2.length + 'objects in array_Name2' );

Open in new window

0
 

Author Closing Comment

by:crundle32
ID: 39592992
thank you
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Introduction Chart.js, used properly, can visually add a difference to your charting applications. It engages your visitors and allows them to interact with data they otherwise wouldn't be able to without expensive and complicated systems. For this…
Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
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…

862 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

23 Experts available now in Live!

Get 1:1 Help Now