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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T22:57:39+00:00 2026-06-17T22:57:39+00:00

I receive a complex JSON from the server. Let it be next: var data

  • 0

I receive a complex JSON from the server. Let it be next:

var data = [{
    name: "name1",
    items:[
        {
        name:"name11",
        subItems:[{
                name:"name111",
                children[
                    {id:1,name:"child1111",status:"good"},
                    {id:2,name:"child1112",status:"bad"},
                    {id:3,name:"child1113",status:"good"}
                ]},
                {
                name:"name112",
                children[
                    {id:4,name:"child1121",status:"good"}]
                }]
        },
        {
        name:"name12",
        subItems:[{
                name:"name121",
                children[
                    {id:5,name:"child1211",status:"bad"}]
                }]
        }]
    },
    {
    name: "name2",
    items:[
        {
        name:"name21",
        subItems:[{
                name:"name111",
                children[
                {id:7,name:"child2111",status:"good"}
                ]}]
        }]
    }];

So I have the list of objects each one contains name and items properties. Items is property of the similar list of objects each one contains name and subItems properties. subItems property same to previous and has name and children properties. children is list of my entities. I use mapping for filling my ViewModel.
First of all I can’t image how to set as key id in my entity. I am wondering how to “dive” to it. Moreover, I need to extend my entity. Add the compute property like next example:

computProp: ko.computed(function() {return name+status;})

I don’t want to create js classes, because I don’t see benefits of mapping on this case. I can implement manual mapping in this case. It would be more clear for me.

So any idea, suggesting or critics are welcome.

PS: I have searched/read similar topics

  • 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-17T22:57:40+00:00Added an answer on June 17, 2026 at 10:57 pm

    You must explicit declare the children viewmodel to get this behaviour, but you still benefit from getting all the mapping done

    http://jsfiddle.net/uXMhA/

    ChildViewModel = function(data) {
        ko.mapping.fromJS(data, {}, this);
        this.computProp = ko.computed(function() {
            return this.name() + this.status();
        }, this);
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I receive a date in the format below from a json file. Im not
I'm trying to receive an array of a complex object from a soap-service written
I'm getting a json from server. I can parse only one JSON at time.
I have a complex iPad app moving to use Core Data. I receive data
I get data back from a php server and sometimes it tosses in warnings.
I am developing an server application that will receive lists of book details from
I receive the following error in Microsoft SQL Server Report Builder Error While generating
I receive messages from a Google Talk account, they are shown in the Table
I receive a string from a database query, then I remove all HTML tags,
We receive lots of data as flat files: delimitted or just fixed length records.

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.