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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T01:42:21+00:00 2026-06-07T01:42:21+00:00

I have this code snippet, which works great somewhere else, but gives me a

  • 0

I have this code snippet, which works great somewhere else, but gives me a circular reference error when I move it to a different section. I can’t even find a good reference on what a circular reference is anywhere.

// Create a new array to hold each of the Properties from the custom search pane
// This array will eventually be converted to JSON and become a List<Property>
propertyTables = [];

// Create new Object to hold a row - we have to construct these 
// Property objects manually for each row
propertyRow = {};

// This needs to be rewritten to include all of hidden input elements from the custom object that is clicked
// For each of the data elements the properties table, add it to the Object
$(this).parent().find('.editablePropertyList .customPropertyPrompt, .editablePropertyList .customPropertyDataType, .editablePropertyList .customPropertyInquirySearchType, .editablePropertyList .customPropertyID, .editablePropertyList .customPropertyText').each(function(index) {
    propertyValue = $(this).val();
    propertyText = $(this).text();
    switch ($(this).attr("class")) {
        case "customPropertyID":
            propertyRow.propertyID = propertyValue;
            break;
        case "customPropertyDataType":
            propertyRow.dataType = propertyValue;
            break;
        case "customPropertyPrompt":
            propertyRow.prompt = propertyText;
            break;
        case "customPropertyInquirySearchType":
            propertyRow.inquirySearchType = propertyValue;
            break;
        case "customPropertyText":
            // Whenever it reaches this data element, this means
            // that the iteration is at the end of a row.  Push the
            // newly filled propertyRow object (typeof Property) on
            // the PropertyTable array.  Then reinstance the propertyRow
            // object and it will start populating with the next row
            // as the next iteration occurs with propertyID
            propertyRow.inquirySearchText = propertyValue;
            if (propertyRow.inquirySearchText !== "") {
                propertyTables.push(propertyRow);
            }
                propertyRow = {};
                break;
            }
    });


    var statusFilter = [];
    var limitAnnotation = [];


    searchCriteria = {}; // Created the object
    searchCriteria.topFolderListBox = topFoldersWithSomeSelected; // Add the List<topLevelFolders> as the first property
    searchCriteria.docTypesListBox = docTypesWithSomeSelected; // Add the List<DocumentType> as the second property
    searchCriteria.propertyTable = propertyTables; // Add the List<Property> as the third property
    searchCriteria.statusFilter = statusFilter; // Add the List<statusFilter> as the fourth property
    searchCriteria.limitAnnotation = limitAnnotation; // Add the List<limitAnnotation> as the fifth property
    searchCriteria.fromDate = ""; // Add the string fromDate as the sixth property
    searchCriteria.toDate = ""; // Add the string toDate as the seventh property
    searchCriteria.dateRangeRelativeToday = false;
    searchCriteria.annotationText = ""; // Add the string annotationText as the eigth and final property

    // Convert to JSON String - craps out here with circular reference error
    textToSend = JSON.stringify(searchCriteria, null, "");
  • 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-07T01:42:23+00:00Added an answer on June 7, 2026 at 1:42 am

    Circular Reference

    In short: It is when objA contains a reference to objB which in turn contains a reference to objA.. and so on. You will have an infinite series like that.

    A simplest example:

    var a = {}
    var b = {}
    a['x'] = b;
    b['y'] = a;
    

    In the above case, a object contains a key x which refers to b. And in the similar fashion, b object contains a key y which refers to a back again.

    This is a classic problem while serialising (like JSON in this case):

    serialise a ->
        serialise value of key x in a ->  # == b
            serialise b ->
                serialise value of key y in b -> # ==a
                    serialise a ->
                        ... and so on..
    

    The error that I get (in Chrome) when trying the above code:

    TypeError: Converting circular structure to JSON
    

    About your problem, it is really difficult to tell where exactly is the circular reference without looking at the entire code. I would suggest one thing. Do a console.log(searchCriteria). If your browser shows a tree like structure go on expanding the nodes until you hit a node which you have seen before (at lesser depth).

    And when you see something like the below, you know what is the culprit. 🙂
    Circular reference problem

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

Sidebar

Related Questions

VS 2008 I have this code snippet I found on a VB website. But
I have a sample code snippet below which works just fine (I trimmed the
I have this code snipped which I use for input validation: public void validaUserID(FacesContext
I have this code snippet: $(function() { $('.toolbar [id^=button]').on('click', function () { $(this) .css('background-color',
I have this code snippet: <div id=div1> </div> <div id=div2> <h3>This is the content</h3>
I have this code snippet inside a function that checks if an object exists
I have this code snippet: DateFormat formatter1; formatter1 = new SimpleDateFormat(mm/DD/yyyy); System.out.println((Date)formatter1.parse(08/16/2011)); When I
I have this code snippet in an email layout: <div> <?php echo $this->Html->image('Layouts/default/Logo.png', array(
I have this JSP code snippet: <%@ taglib uri=http://java.sun.com/jsp/jstl/core prefix=c%> <c:choose> <c:when test=${var1.properties[\Item Type\]
Let us say if I have a Perl module Resounces.pm with this code snippet

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.