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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T13:02:27+00:00 2026-06-04T13:02:27+00:00

I wish to iterate over an object’s properties and change them all to include

  • 0

I wish to iterate over an object’s properties and change them all to include "" around the value stored in them.
This object is passed to a REST call and the above format must be enforced. I prefer to handle the addition of "" in a central location, rather when assigning the actual values (the code is very complex and long).

I know that you can iterate through the object’s properties easily:

$.each(queryOptions, function(obj){console.log(obj)})

However, can I somehow get reference to the actual property and set it from within the iteration?

Input:

queryOptions.value1 = 1234;
queryOptions.value2 = "testing";
queryOptions.value3 = 555;

Desired output:

queryOptions.value1 = "1234";
queryOptions.value2 = ""testing"";
queryOptions.value3 = "555";

Thanks

  • 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-04T13:02:29+00:00Added an answer on June 4, 2026 at 1:02 pm

    I agree with Pointy that this seems an odd requirement. But if it’s really a requirement:

    Using $.each:

    $.each(queryOptions, function(key) {
        queryOptions[key] = '"' + queryOptions[key] + '"';
    });
    

    Or just using JavaScript without any library stuff:

    var key;
    for (key in queryOptions) {
        if (queryOptions.hasOwnProperty(key)) {
            queryOptions[key] = '"' + queryOptions[key] + '"';
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have list of dictonaries. I wish type iterate over this list and map
I wish to iterate over a collection in a thread safe manner. I find
I'm facing this weird issue with Scripting.Dictionary object in my VBA code. I wish
I wish to iterate over a set but the contents of the set will
If I have an object implementing the Map interface in Java and I wish
I have an XML file loaded into a DOM document, I wish to iterate
I wish to iterate through a form, adding each element to an area. The
I wish to send Python script a definition file (with key and value pairs)
I wish to extract all the tag names and their corresponding data from a
I wish to Avoid duplicated item being inserted. When I iterate through the collection

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.