Solved

Json Multi-Array

Posted on 2013-10-22
2
326 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
Comment Utility
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
Comment Utility
thank you
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

In this article you'll learn how to use Ajax calls within your CodeIgniter application. To explain this, I'll illustrate how to implement a simple contact form to allow visitors to send you an email through your web site.
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 how to dynamically set the form action using jQuery.
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)

743 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

16 Experts available now in Live!

Get 1:1 Help Now