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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T19:41:23+00:00 2026-05-10T19:41:23+00:00

It sounds a lot more complicated than it really is. So in Perl, you

  • 0

It sounds a lot more complicated than it really is.

So in Perl, you can do something like this:

foreach my $var (@vars) {   $hash_table{$var->{'id'}} = $var->{'data'}; }  

I have a JSON object and I want to do the same thing, but with a javascript associative array in jQuery.

I’ve tried the following:

hash_table = new Array();  $.each(data.results), function(name, result) {   hash_table[result.(name).extra_info.a] = result.(name).some_dataset; }); 

Where data is a JSON object gotten from a $.getJSON call. It looks more or less like this (my JSON syntax may be a little off, sorry):

{   results:{     datasets_a:{       dataset_one:{         data:{           //stuff         }         extra_info:{           //stuff         }       }       dataset_two:{          ...       }       ...     }     datasets_b:{       ...     }   } } 

But every time I do this, firebug throws the following error:

‘XML filter is applied to non-xml data’

  • 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. 2026-05-10T19:41:23+00:00Added an answer on May 10, 2026 at 7:41 pm

    I think you can use the JSON response as an associative array. So you should be able to go directly in and use the JSON.

    Assuming you received the above example:

    $('result').innerHTML = data['results']['dataset_a']['dataset_two']['data']; // Or the shorter form: $('result').innerHTML = data.results.dataset_a.dataset_two.data; 

    Understand that I haven’t tested this, but it’s safer to use the square brackets with a variable than it is to use parenthesis plus the name with the dot accessor.

    Your example is failing because of some convoluted logic I just caught.

    $.each(data.results), function(name, result) {      hash_table[result.(name).extra_info.a] = result.(name).some_dataset; }); 

    Now, the foreach loop goes through the variable data.results to find the internal elements at a depth of 1. The item it finds is given to the lambda with the key of the item. AKA, the first result will be name = 'datasets_a' item = object. Following me so far? Now you access the returned hash, the object in item, as though it has the child key in name … ‘datasets_a’. But wait, this is the object!

    If all else fails… write your result JSON into a text field dynamically and ensure it is formatted properly.

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

Sidebar

Related Questions

This sounds like a really simple question, but I am new to PHP. If
The title sounds like there is a lot of problems ahead. Here's my specific
How can I play more than one .m4a file consecutively? Presently, my function starts
My application is a soundboard app, but there is a lot of sounds in
Sounds like a stupid question, doesn't it? But the page on the Jettison project
Sounds like a stupid question with an obvious answer :) Still I've ventured to
That sounds complicated, doesn't it... actually it's quite easy: I have a multi-language app
This sounds funny..just a little experiment. i wanted to simulate a drag drop of
That sounds pretty odd but i have this cod and i need to convert
This sounds simple but my regex knowledge is limited. I need an expression to

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.