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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:14:24+00:00 2026-05-29T10:14:24+00:00

I have a JSON file and i have to read data from this file

  • 0

I have a JSON file and i have to read data from this file when the page loads. I suspect there is something wrong with my JSON Structure. JSONLint is showing that it is valid. So i must be using the wrong method to access it.

It is basically an array of objects (or that is what i think).

{"Listings":[
{"Listing1":
    {
        "agency_code":"BP",
        "property_code":"BON1",
        "Property_GUID":"6dded624",
        "FileNo /":"",
        "country":"AUSTRALIA",
        "state":"New South Wales",
        "subregion /":""
            }
        },
   {"Listing1":
    {
        "agency_code":"BPGA",
        "property_code":"BONNSTG4-Lot11",
        "Property_GUID":"6dded624-cde2-429a-81d4-bd6f91256345",
        "FileNo /":"",
        "country":"AUSTRALIA",
        "state":"New South Wales",
        "subregion /":""
            }
        }
    ]
}

I am using the $.ajax to read the JSON. The file is loading successfully. Now how do i access the individual “listings” and how to measure how many Listings are present in total?
I tried the $.each to loop through the array but my code is not working.

  • 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-29T10:14:25+00:00Added an answer on May 29, 2026 at 10:14 am

    You have an array of objects, but that array is not the first tier, it’s stored in the top-level Listings property.

    $.ajax({
        dataType : 'json',
        success  : function (response) {
            for (var i = 0, len = response.Listings.length; i < len; i++) {
                //You can now access individual properties like this:
                var agencyCode = response.Listings[i].Listing1.agency_code;
            }
        }
    });
    

    This for loop will perform faster than jQuery’s .each() or $.each(): http://jsperf.com/jquery-each-vs-for-loops/2

    Here is a demo: http://jsfiddle.net/btHy5/1/

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

Sidebar

Related Questions

I have a web service that queries data from this json file, but I
I have one view where I read json data. and extract keys from it.
I am trying to read a JSON file and parse it. I have this
I have been struggeling all day to read a json file from server and
I have an AS 3.0 class that loads a JSON file in using a
I have this swf (flash) file that provides the json that needs to be
Suppose you are working with some data, which comes from a JSON file. You
I have a json file. (data.json) { oneday:[[8, 5],[12, 9],[16, 1]], oneweek:[[1, 5],[2, 9],[3,
I have JSON in a text file, and I read the bytes of the
I have some json data [{a:10, b:123,c:4.5},{a:2,b:5,c:33}] and so on that I read into

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.