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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T10:22:53+00:00 2026-06-02T10:22:53+00:00

Below I have the following code: var imageType = BoxArt; var uploadReason = New

  • 0

Below I have the following code:

var imageType = "BoxArt";
var uploadReason = "New season";
var fileKey = "b2fc";

alert("imageType = " + imageType);
alert("uploadReason = " + uploadReason);
alert("fileKey = " + fileKey);

var iVO = { "images":{}};
var thisImage = fileKey;
iVO["images"][thisImage.fileKey] = thisImage;
iVO["images"][thisImage.imageType] = imageType;
iVO["images"][thisImage.uploadReason] = uploadReason;

alert("iVO['images'][thisImage.imageType] = " + iVO["images"][thisImage.imageType]);
alert("iVO['images'][thisImage.uploadReason] = " + iVO["images"]    [thisImage.uploadReason]);
alert("iVO['images'][thisImage.fileKey] = " + iVO["images"][thisImage.fileKey]);
alert("JSON.stringify(iVO):\n" + JSON.stringify(iVO));

When I execute this I get the following output:

imageType = "BoxArt"
uploadReason = "New season"
fileKey = "b2fc"
iVO['images'][thisImage.imageType] = "New season"
iVO['images'][thisImage.uploadReason] = "New season"
iVO['images'][thisImage.fileKey] = "New season"
JSON.stringify(iVO):
{"images"}:{"undefined":"New season"}}

What is going on here?!?!?

The first three alerts (showing imageType, uploadReason, and fileKey assignments) are as expected, but the iVO object is not acting at all like I expected. The JSON.stringify method is the normal json2.js method, and I haven’t modified it.

Why is “New season” showing up as every iVO["images"] field value? Why aren’t the iVO assignments working properly?!? What do I need to do to fix them?

The desired output of JSON.stringify(iVO) would be (in pretty-print form):

{
    "images":
    {
        "b2fc":
        {
            "imageType":"BoxArt",
            "uploadReason":"New season",
            "fileKey":"b2fc"
        }
    }
}

Thanks in advance!

  • 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-02T10:22:57+00:00Added an answer on June 2, 2026 at 10:22 am

    for sure, where you defined

    iVO["images"][thisImage.fileKey] = thisImage;
    iVO["images"][thisImage.imageType] = imageType;
    iVO["images"][thisImage.uploadReason] = uploadReason;
    

    thisImage is a string by previous assignment to fileKey so thisImage.fileKey, thisImage.imageType and thisImage.uploadReason are invalid references

    probably you want to do something like iVO["images"][fileKey]["imageType"] = imageType

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

Sidebar

Related Questions

I have the following code, see below: $(document).ready(function(){ var prefixNumber = $('.numeric').val(); if(prefixNumber.match(????){ prefixNumber.addClass('.field-error');
I have the following code below that is meant to change a class var
I want to know is below code correct ? I have following code which
i have the following code below: const char* timeformat = %Y-%m-%d %H:%M:%S; const int
i have the following code: <h3> Your Profile </h3> The information below is what
I have the following C# code below. Object first = 5; Object second =
I have the following code example (see below). My problem is that the tooltip
See i have this following code below, at line no.9 i'm calculating some dates
UPDATE : I have the following code: <script type=text/javascript> function addScript(url) { var script
I have the following code to encrypt a value (listed below). Now I would

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.