Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8129867
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T08:28:02+00:00 2026-06-06T08:28:02+00:00

I have a json response like: { total: 2, success: true, rows: [ {a1_id:7847TK10,

  • 0

I have a json response like:

{ "total": 2, "success": true, "rows": [ {"a1_id":"7847TK10", "output2":"7847TK10", etc. 
etc} ]}

Now my Google Visualization (Pie Chart) code only executes well when:

<script type="text/javascript">

// load visualization library
google.load('visualization', '1', {packages: ['corechart']});

$(function() { 
     // when document loads, grab the json
     $.getJSON('regiontop11.json', function(data) {
         // once grabbed, we run this callback

         // setup the new map and its variables
         var map = new google.visualization.DataTable();
             map.addRows(data.length);  
             map.addColumn('string', 'outputsix');
         map.addColumn('number', 'outputnine');

         // now we need to build the map data, loop over each result
         $.each(data, function(i,v) {
             // set the values for both the name and the population
             map.setValue(i, 0, v.output6);
             map.setValue(i, 1, v.output9);
         });
         // finally, create the map!
         var chart = new google.visualization.PieChart(
           document.getElementById('visualization'));
              chart.draw(map, null);

     });
});

</script>

….I adjust my json to:

[ {"a1_id":"7847TK10", "output2":"7847TK10", etc. etc} ]

Problem is I can’t adjust the json.php itself because the extended (see above) output is necessary for other applications. So just skipping the { “total”: 2, “success”: true, “rows”: portion of it is no option. Both versions are valid Json.
Can I do something in my browser-Pie Code- with eg JQuery? Solutions more than welcome!

regards
Peter

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T08:28:04+00:00Added an answer on June 6, 2026 at 8:28 am

    You can pull the content you need out of the JSON envelope before you use it for the DataTable.

    If the response is like this:

    {
      "total": 2,
      "success": true,
      "rows": [{
          "a1_id": "7847TK10",
          "output2": "7847TK10",
          etc.
          etc
      }]
    }
    

    Then you can get what you want like this:

     $.getJSON('regiontop11.json', function(data) {
    
         var rows = data.rows;
    
         var map = new google.visualization.DataTable();
         map.addRows(rows.length);  
         map.addColumn('string', 'outputsix');
         map.addColumn('number', 'outputnine');
         ...
         $.each(rows, function(i,v) {
         ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a JSON response from a web server that looks like this: {success:true,
I have a JSON response from Facebook liking like this. [ {uid=>123, name=>Test, is_app_user=>true},
I have a json response like this { latitude: 30.4848, longitude: -70.5484 } Now
rails 3: include_root_in_json = true allows to have a root property for json response.
I have a JSON response that returns an array like so: [1, 1] [2,
I have a JSON response that looks like this. I want to extract the
i have the following JSON response from google maps. I've given two postcodes as
I have a REST API where I would like to cache the JSON response
I have a JSON response like this { car:100, house:200, bike:300 } But sometimes
I have a JSON response like this: var errorLog = [[\comp\,\Please add company name!\],

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.