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

  • Home
  • SEARCH
  • 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 7676613
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T17:14:21+00:00 2026-05-31T17:14:21+00:00

I have a REST service that returns a collection that contains non- normalized data.

  • 0

I have a REST service that returns a collection that contains non-
normalized data. For example, it might look something like this:

root
.
root:CollectionItem[0].alpha
root:CollectionItem[0].beta
root:CollectionItem[0].zappa
.
root:CollectionItem[1].alpha
root:CollectionItem[1].children[0].MoonUnit
root:CollectionItem[1].children[1].Dweezil
root:CollectionItem[1].zappa
.
root:CollectionItem[2].alpha
root:CollectionItem[2].beta
root:CollectionItem[2].zappa

What’s the best strategy for using the Mapping PlugIn with non-normalized JSON data like this? The problem is that the PlugIn seems to use CollectionItem[0] as a template, but when I foreach through a result, Knockout is blowing up when I try to read root.CollectionItem[1].beta (which doesn’t exist).

EDIT #1: I guess Knockout isn’t as popular as I thought… This question seems destined for a Tumbleweed Award. 🙁

EDIT #2: Got a workable answer on the Knockout Forum http://groups.google.com/group/knockoutjs/browse_thread/thread/6705c222481c7b75#, so I don’t have to worry about another Tumbleweed Award! 🙂

  • 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-31T17:14:22+00:00Added an answer on May 31, 2026 at 5:14 pm

    I got an answer from someone named NTB on the Knockout JS forum. Here’s his solution on JS fiddle in case anyone is interested. Hate to answer my own question, but it is what it is.

    http://jsfiddle.net/PxeyY/

    Here’s his summary:

    “I have
    sometimes manually “massaged” the data before calling the mapper, or
    created a dummy shell object that has all the possible properties set to
    null (or [] in the case of arrays) — then use $.extend(dummy, real) to
    create something .fromJS() can work with. You’d have to iterate through
    the array with that pattern, but that’s my $.02 anyway.

    “Would like to hear cleaner solutions myself too though.”

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

Sidebar

Related Questions

I have a REST service that returns a list of objects. Each object contains
I have a REST web service that returns an xml result like this: -
I have a WCF rest service using webHttpBinding that returns JSON result. The problem
I have successfully set up a quick test of creating a REST-like service that
I have constructed a simple Rest service using ServiceStack (which is brilliant), that returns
I have a REST web service that returns a structure containing an array of
I have a REST web service that returns a javax.ws.rs.core.Response entity. When I run
I have a REST-service that returns JSON. But the JSON response returned with \
I have a WCF rest service. It has a method that returns a list
I have created a WCF REST service that returns JSON, but the properties in

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.