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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T22:34:17+00:00 2026-05-21T22:34:17+00:00

this perhaps a simple question for some of you here. But i just don’t

  • 0

this perhaps a simple question for some of you here. But i just don’t how to do this and I need help BADLY. Here’s my json:

{"name":"cust_num","comparison":"starts_with","value":"01"},
{"name":"cust_name","comparison":"starts_with","value":"ad"},
{"name":"cust_age","comparison":"=","value":"20"}

my program JSON alerts like this:

 {
    "ID":"TBsKI7",
    "dataType":"data",
    "filters":[
        "{\"name\":\"cust_num\",\"comparison\":\"starts_with\",\"value\":\"01\"}",
        "{\"name\":\"cust_name\",\"comparison\":\"starts_with\",\"value\":\"ad\"}",
        "{\"name\":\"cust_age\",\"comparison\":\"=\",\"value\":\"20\"}
     ],
    "recordLimit":50,
    "recordOffset":0,
      .
      .
      .
 }

this is obviously an error. It seems to me that the first json was stringified twice (if I am right with using the term). Now, what i want is how to correct my first json, or how to parse it, so that it will output with no ‘\’.

i already tried using jQuery.parseJson() but it returns null.

thank you for reading.

EDIT:
This is my javascript code that produces the above json:

$('#table tr').each(function(){  
  var td = '';                   
  if ($(this).find("td:first").length > 0) {    // used to skip table header (if there is)            
    $(this).find('option:selected').each(function(){
    td = td + $(this).text()+ ',';
    });
    td = td + $(this).find('input').val();
    filt[ctr]=td;
    ctr += 1;           
  } 
});


for (var i = 0;i<filt.length;i++) {
  b = filt[i].split(','); 
  if (b[0] == "no"){
    b[0] = "cust_num";
  }
  if (b[0] == "name"){
    b[0] = "cust_name";
  }
  if (b[0] == "age"){
    b[0] = "cust_age";
  }
  jsonobj.name = b[0];
  jsonobj.comparison = b[1];
  jsonobj.value = b[2];
  c[i] = JSON.stringify(jsonobj); //if json.stringify, it will display the json with '\'
                      //if not, its only the last filter will be read for all the tr. 

}   

i have a dynamic table that will accept data that i will used to create json.

  • 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-05-21T22:34:18+00:00Added an answer on May 21, 2026 at 10:34 pm

    I hope you are defining your vars somewhere. Outside of the for loop, you should be doing

    var c = [];
    

    Then try

    c.push({
       name: b[0],
       comparison: b[1],
       value: b[2]
    });
    

    instead of

    jsonobj.name = b[0];
    jsonobj.comparison = b[1];
    jsonobj.value = b[2];
    c[i] = JSON.stringify(jsonobj);
    

    and then you should be able to do

    JSON.stringify(c);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is perhaps more of a discussion question, but I thought stackoverflow could be
Perhaps this question has been asked elsewhere, but I'm unable to find it. With
I have an ObjectDataSource (but perhaps this question is the same for all kinds
OK, this is perhaps stupidest question ever but bear with me.... How to make
Perhaps this is answered out there somewhere and I just don't know the words
I feel like the answer to this question is probably very simple, but I'm
This seems like a noob question, but the simple answer is eluding me. I
here's a very simple js but i don't know where to begin. in a
Perhaps I'm missing something simple, as I believe that this is a common scenario...
I probably just haven't thought this through, or perhaps I'm simply unaware of an

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.