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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T10:25:47+00:00 2026-06-12T10:25:47+00:00

I have this json array: var a = [{results:[{id:25,name:John,age:46},{id:41,name:Sonny,age:31}],count:2,total:14}]; It contains an array called

  • 0

I have this json array:

var a = [{"results":[{"id":"25","name":"John","age":"46"},{"id":"41","name":"Sonny","age":"31"}],"count":2,"total":14}];

It contains an array called “results” and two other variables with numerical values, count and total.

How can i get each of the values of “results”, “count” and “total” from the above array ?

I tried: console.log(a.count);

But it says undefined.

  • 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-12T10:25:48+00:00Added an answer on June 12, 2026 at 10:25 am

    First, execute your code will cause SyntaxError: Unexpected token ILLEGAL.

    There is an invalid character after age between "age"‌​:"31".

    Remove that, then a is an array, so you get the first element by a[0],

    then

    get the count by a[0].count

    get the results by a[0].results

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

Sidebar

Related Questions

i have this JSON: var projects_array = new Array( {name:myName1, id:myid1, index:1}, {name:myName2, id:myid2,
I have a json output array like this { data: [ { name: Ben
i have a varable: var name = name; this will be inside an array
I have a JSON array like this: { forum:[ { id:1, created:2010-03-19 , updated:2010-03-19
I have some troubles mapping a JSON Array to RestKit. This is what the
I have a json object that looks something like this: Array ( [algorithm] =>
i have this JSON object: {error:null, result:[{id:1234567890, count:1, recipients: [u3848, u8958, u7477474 ], dateCreated:2012-06-13T09:13:45.989Z
code //array store the markers var googleMarker = []; //this function get json object
I have a two dimensional JSON array returned from a PHP script via a
I have this json data, so i having problems to count the numbers of

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.