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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T16:17:11+00:00 2026-06-05T16:17:11+00:00

A bit of a mystery has cropped up using knockout (2.1.0) and knockout mapping

  • 0

A bit of a mystery has cropped up using knockout (2.1.0) and knockout mapping (2.1.2) in IE9. For some reason, array indices of objects get turned into parent objects. For example:

ko.mapping.toJSON(attachments);

produces something that looks like this in Chrome:

{
    "UserID": 432,
    "Attachments": [{
        "AttachmentID": 2,
        "OwnerID": 321,
        "DisplayName": "sample.pdf",
        "Description": "desc",
        "PostDate": "2012-06-01T09:24:43.817"
        }, {
        "AttachmentID": 3,
        "OwnerID": 432,
        "DisplayName": "sample3.pdf",
        "Description": "desc",
        "PostDate": "2012-06-05T14:01:00.693"
        }, {
        "AttachmentID": 4,
        "OwnerID": 543,
        "DisplayName": "sample2.pdf",
        "Description": "desc",
        "PostDate": "2012-06-05T14:01:49.18"
        }]
}

… but in IE9, produces something like this:

{
    "UserID": 432,
    "Attachments": {
    "0": {
        "AttachmentID": 2,
        "OwnerID": 321,
        "DisplayName": "sample.pdf",
        "Description": "desc",
        "PostDate": "2012-06-01T09:24:43.817"
    },
    "1": {
        "AttachmentID": 3,
        "OwnerID": 432,
        "DisplayName": "sample3.pdf",
        "Description": "desc",
        "PostDate": "2012-06-05T14:01:00.693"
    },
    "2": {
        "AttachmentID": 4,
        "OwnerID": 543,
        "DisplayName": "sample2.pdf",
        "Description": "desc",
        "PostDate": "2012-06-05T14:01:49.18"
    }
    }
}

This breaks my knockout bindings because the template is expecting attachments to be a first-order array.

Interestingly, json2’s stringify returns the first output (which is what I’d expect) in every browser I’ve tried.

Has anyone seen this behavior before? Any ideas on how to correct it?

  • 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-05T16:17:12+00:00Added an answer on June 5, 2026 at 4:17 pm

    The short version is that I didn’t find an answer to the problem, but I did find a workaround. It isn’t pretty. If i override the JSON object and force it to use JSON3 using delete window.JSON;, then do some stringify hocus pocus like this:

    var jsonString = JSON.stringify(objToBind);
    var reconstitutedObject = ko.utils.parseJson(jsonString);
    

    … create the mapping from the reconstituted object and bind to the reconstituted object, the extra container seems to be gone. This suggests to me that there is something extra in the array definition that is being interpreted as a container, but after poking around in the guts of the main project, sniffing network traffic, and trying to drill down into how the server responds, I’m coming up short.

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

Sidebar

Related Questions

Bit of an odd question but is there a way of seeing what objects
Bit confused here, I have an on-demand instance but do I get charged even
This is a bit of a mystery to me since you have to be
Bit of Background info, I'm using An NSOutlineView with Core Data. This Is What
A bit of a mystery. I have a UITabBar with 4 items. Item 1,
Ok, so I have a bit of a mystery on my hands. I hve
Bit of a newb but just having a small problem using jquery cycle all
Bit of additional info... PHPBB has a way to redirect you after login to
Bit of an odd question, but I'm using sessions a lot in a project.
I have a bit of a mystery here that I am not quite understanding

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.