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

  • Home
  • SEARCH
  • 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 9164829
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T14:46:27+00:00 2026-06-17T14:46:27+00:00

I am trying to get a value from json by using the JSON.parse function.

  • 0

I am trying to get a value from json by using the JSON.parse function. My json response is given below:

{
  "rows": 10,
  "os": "0",
  "page": "1",
  "total": "122",
  "projects": {
    "P143841": {
      "id": "P143841",
      "locations": [{
        "geoLocId": "0002220957",
        "latitude": "3.866667",
        "longitude": "11.516667"
      }],
    }
  }
}

I am able to get the value 10 if I do JSON.parse(obj.rows) but if I assign the rows to a variable say var value = rows and then I pass it to the JSON.parse(obj.value) function I got undefined.

P.S. I won’t be knowing the names of the response parameters, i.e. i won’t know if it will be rows or os quoting from the above example. I will be retrieving them from a database. If I perform the code below:

  for (var i=0;i<length;i++) {
    var value = responseParam_array[i];
    console.log(obj.value);
  }

I get the output but any help will be much appreciated.

  • 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-17T14:46:28+00:00Added an answer on June 17, 2026 at 2:46 pm

    As per the other answers you shouldn’t need to parse individual properties, just parse the original JSON and then operate on the resulting object.

    But as for this problem:

    “if I assign the rows to a variable say var value = rows and then I pass it to the JSON.parse(obj.value) function I got undefined“

    If value is a variable holding the name of a property of obj then you need:

    obj[value]
    // NOT
    obj.value
    

    When you use “dot” notation the part on the right of the dot is taken as the literal name of the property, not as a variable. Using the square-bracket syntax the expression in the brackets is evaluated and its result is taken as the property name.

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

Sidebar

Related Questions

I am trying to parse a JSON response from a server using javascript/jquery. This
I'm trying to get a value from an HTML page that has the name
I am trying to parse a result (JSON) fetched from the Facebook API using
I was trying to parse response data from web server. I am using Xcode
I am trying to parse the JSON file shown below, and get the coordinates
I am trying to call an ASMX from jQuery using JSON and get a
I am trying to get a response from the movie db using its default
I'm trying to get a json string back from my controller, that is prefill-values
I am trying to get value from passwordbox for developing a simple login functionality,
While i am trying to get value from arraylist,i got the following errors.My sample

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.