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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T02:09:03+00:00 2026-06-08T02:09:03+00:00

I am trying to read a json from javascript. I already am able to

  • 0

I am trying to read a json from javascript. I already am able to read the file but I have some problems retrieving info from that file because of its structure. I don’t know the name of some levels…

This is an example:

{
    "zona": [{
        "zona1": [{
            "lon": "-3.841867446899414",
            "lat": "43.466002139041116"
        }, {
            "lon": "-3.838176727294922",
            "lat": "43.466002139041116"
        }, {
            "lon": "-3.838348388671875",
            "lat": "43.46432016607394"
        }, {
            "lon": "-3.843669891357422",
            "lat": "43.46276274196949"
        }]
    }, {
        "zona2": [{
            "lon": "-3.832254409790039",
            "lat": "43.462513550389424"
        }, {
            "lon": "-3.8265037536621094",
            "lat": "43.46375949801845"
        }, {
            "lon": "-3.8254737854003906",
            "lat": "43.461641371770504"
        }, {
            "lon": "-3.829936981201172",
            "lat": "43.46002157809642"
        }, {
            "lon": "-3.832683563232422",
            "lat": "43.461142978339005"
        }]
    }]
}

I tried to do something like this but I think I was a little bit innocent lol

function fun() {
    var zona;
    $.getJSON('listaPuntosZona.json', function(data) {
        for (i = 0; i < data.zona.length; i++) {
            zonaX = 'zona' + (i + 1);
            alert(data.zona[i].zonaX.length);
        }
    });

I have read about foreach loops but I don’t understand them so I can’t write a code for them. Is there a way to do as I am thinking?
Third parameter, ZonaX goes from zona1 to zonaN but 1,2,3….N, always +1.

  • 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-08T02:09:05+00:00Added an answer on June 8, 2026 at 2:09 am

    To explore unknown JSON/object structures you may call the function walk(data) as
    … function(data) {walk(data); …

            function walk(data) {
                if(typeof(data) == "object") {
                    for(key in data) {
                       console.log(key+": "+data[key]);
                       walk(data[key]);
                    }
                }
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi I am trying to read in a .json file from my local machine.
Is it possible to edit a JSON file using javaScript? I'm trying to read
I am trying to read a JSON file and parse it. I have this
I'm trying to make a windows phone application that reads a json file from
I'm trying to read some JSON data from the Tumblr API. I'm using the
Hey I'm trying to read data from a JSON File with jQuery. This is
I am trying to read certain values from a json string in php, I
I'm trying to return json content read from MySQL server. This is supposed to
I'm trying to read data from a service (returns JSON object) and create an
I'm trying to read my json data, but it crashes. NSString *hostStr = @http://www.myIP.com/notices.php;

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.