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 961645
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T01:22:45+00:00 2026-05-16T01:22:45+00:00

I am using this array( as an example) http://pastebin.com/M0ZJgAVs i am using json_encode() on

  • 0

I am using this array( as an example)
http://pastebin.com/M0ZJgAVs

i am using json_encode() on it and fetching it using javascript

does anyone care to tell me

to get the num rows would i simply use

var numrows = json['numrows'];

and to loop over each row
would i use

for(row in json['rows']) {
}

and then inside that to get to each datapoint would i just use

for(data in row) {

}

or am i completely off track?

  • 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-05-16T01:22:45+00:00Added an answer on May 16, 2026 at 1:22 am

    If you receive the deserialized JSON data in the JavaScript as an object json, then the code could looks like following

    var rows = json.rows; // cache json.rows array in a variable for better performance
    for (var iRow=0, cRows = rows.length; iRow<cRows; iRow++) {
        var row = rows[iRow];
        for (var iData=0, cData = row.length; iData<cData; iData++) {
            var data = row[iData];
            // do something with the data like
            // alert(data);
        }
    }
    

    In general you receive typically JSON data in deserialized form as an object (if you use jQuery.ajax for example). So the access of the data in JavaScript is very simple. It is just accessing of the fields of the object or accessing of the elements of the array. For performance purpose only it is better to use always an indexed loop as a "for in" loop (see http://www.jslint.com/lint.html#forin). If you access a property of an object (like the property rows) it is always better to use dotted notation (json.rows) as an index notation (json[rows]). And the last recommendation is caching property value in a local variable (like var row=rows[iRow] or var cRows = rows.length) always if you access the property more as one time.

    You can find interesting information from http://jquery-howto.blogspot.com/2009/06/javascript-for-loop-vs-jquery-each.html about the more effective way to enumerate data in the array (read also the last version of the suggested loop in the comment).

    It is also a good idea to verify your JavaScript code in JSLint (see http://www.jslint.com/).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 502k
  • Answers 502k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Okay, I found the problem. My ActionQueue class was creating… May 16, 2026 at 2:44 pm
  • Editorial Team
    Editorial Team added an answer As of Spring 3.0, the entire Controller hierarchy has been… May 16, 2026 at 2:44 pm
  • Editorial Team
    Editorial Team added an answer I have tried to reproduce this issue and see this… May 16, 2026 at 2:44 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

For example using this Wikipedia dump: http://en.wikipedia.org/w/api.php?action=query&prop=revisions&titles=lebron%20james&rvprop=content&redirects=true&format=xmlfm Is there an existing library for Python
i am using this site as a resource http://www.perlmonks.org/?node_id=573138 I am trying to understand
And can you give me an example of an algorithm? alt text http://ryancalderoni.com/archive/ideal_curve.jpg EDIT:
I am trying to parse my URL into different parts using this RegExp: ([\w\\.-]*)
i want to make a new data structure using arrays for this query it
I'm using this function that helps my webdevelopers to find a piece of code
I am having trouble understanding / using name spaces with XML::LibXML package in Perl.
My current project requires locating an array of strings within an element's text content,
I have an array from a $_GET say Array ( [0] => 0 [1]
I am trying to grab some data via JSONP. Using Firebug, I am able

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.