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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T22:53:11+00:00 2026-06-07T22:53:11+00:00

Chrome’s array.map works fine, but jQuery’s .map produces a circular reference somehow. I can’t

  • 0

Chrome’s array.map works fine, but jQuery’s .map produces a circular reference somehow. I can’t see any evidence of a circular reference using console.log, but JSON.stringify throws Uncaught TypeError: Converting circular structure to JSON in the second block.

Run it on JSFiddle: http://jsfiddle.net/langdonx/vQBak/

Or check the code:

var callback = function(index, element) {
    return {
        "index": index
    };
};

var array1 = ["1", "2"];
var mappedArray1 = array1.map(callback);
console.log(mappedArray1);
var json1 = JSON.stringify(mappedArray1);
console.log(json1);

var jqueryArray2 = $('body > div');
var mappedArray2 = jqueryArray2.map(callback);
console.log(mappedArray2);
var json2 = JSON.stringify(mappedArray2); // Chokes with "Uncaught TypeError: Converting circular structure to JSON"
console.log(json2);​

Yes, I’m using the same callback, and yes ECMAScript’s map passes the arguments in a different order, but it shouldn’t matter for this example, as they’re all simple types (string, number).

  • 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-07T22:53:12+00:00Added an answer on June 7, 2026 at 10:53 pm

    The jQuery .map() function returns a jQuery object containing an array, not an actual array, which may be an important difference. Try calling:

    var json2 = JSON.stringify(mappedArray2.get());
    

    The call to .get() will return the actual array rather than a jQuery object.

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

Sidebar

Related Questions

As chrome.browserAction.onClicked works only if there is no popup, is there any alternative method
In chrome and safari, the following code works fine. in firefox , all platforms,
Chrome, Opra and IE all show the first alert, but do not show any
Chrome, Safari, Opera and IE work fine. But Firefox fails to load images. This
Chrome works just fine, and my Greasemonkey script, if copy/pasted into Firefox's Firebug, works
Hello Chrome Extension geeks, Is there any way that we can read a the
Chrome simply refuses to run any Javascript. It shows a Failed to load resource
For chrome the event fires on page load, but in firefox it fires the
Chrome (or any other webkit browser) throws a ton of these Unsafe JavaScript attempt
A Chrome extension I built a few months ago has been working fine until

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.