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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T03:52:33+00:00 2026-06-16T03:52:33+00:00

So I fetch a multidimensional JSON array with getJSON and I want to access

  • 0

So I fetch a multidimensional JSON array with getJSON and I want to access values in the array, but can’t reach longer than the first element in the array.

"producers",
[
    {
        "producer":{
            "id":"1",
            "name":"Em\u00e5mejeriet",
            "address":" Grenv\u00e4gen 1-3",
            "zipcode":" 577 39",
            "district":" Hultsfred",
            "webpage":"http:\/\/www.emamejeriet.se",
            "logoURL":"..\/producenter\/images\/ema.png",
            "latitude":"57.4999",
            "longitude":"15.828"
        }
    },
    {
        "producer":{
            "id":"2",

…and so on.

My code:

$.getJSON("/url/producers.json", function(data) {
    $.each(data, function() {
        $.each(this, function(key, value) {
            console.log(value.producer);
        });
    });
});

The output is an object, I don’t know any better way to paste it, copied from the browsers console: “> Object {id: "1", name: "Emåmejeriet", address: "Grenvägen 1-3, zipcode: "577 39", disctrict: "Hulsfred"...}

I’ve searched and tested different approaches as I said, from this forum, but couldn’t get my head around it.

  • 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-16T03:52:35+00:00Added an answer on June 16, 2026 at 3:52 am

    If the output of value.producer is an object, then you should be able to access the properties of that object. For example, value.producer.name should output ‘asdfsadf’.

    UPDATE

    It looks as though your json data is not valid. (I’m assuming “producers” is a property of the data object and the value of that property is an array of all of the “producer” objects.)

    I’ve created this fiddle ( http://jsfiddle.net/kAsPm/ ) and it works as expected. I just had to change the comma to a colon after “producers”:

    "producers":  // changed from "producers",
    [
        {
            "producer":{
                "id":"1",
                ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to fetch the user groups and want to list them but I
I am having trouble updating the values of an multidimensional associative array. The array
I want to make a multidimensional array in php. Here is what i have
How to search value in multidimensional array, for example I want to search example
How do I form a multidimensional array using MySQL data? I'm using this code
i fetch data via NSURLConnction from a server and want to populate a tableview
Possible Duplicate: in_array() and multidimensional array Got the following array returned from a database
i have a multidimensional array. the array is returned by parsing xml using curl.
I want to group subcateogries within categories. The subcategories can have any number of
I want to create a Array with multidimension arrays from a database. The Database

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.