Solved

Json Multi-Array

Posted on 2013-10-22
2
358 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
[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 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

The Ultimate Checklist to Optimize Your Website

Websites are getting bigger and complicated by the day. Video, images, custom fonts are all great for showcasing your product/service. But the price to pay in terms of reduced page load times and ultimately, decreased sales, can lead to some difficult decisions about what to cut.

Question has a verified solution.

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

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…
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
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…

729 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