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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T08:13:54+00:00 2026-06-01T08:13:54+00:00

I have the following JSON coming back from a web service which I am

  • 0

I have the following JSON coming back from a web service which I am trying to bind to a simple list just to show the name and image for customers:

{"Customers":{"data":[{"CustomerID":1,"CustomerName":"Jones","CustomerImage":"~/Images/Customers/Jones02.gif","CustomerEnabled":true},{"CustomerID":7,"CustomerName":"Hughes","CustomerImage":"~/Images/Customers/Hughes057847.gif","CustomerEnabled":true},{"CustomerID":13,"CustomerName":"Michaels","CustomerImage":"~/Images/Customers/M12012.gif","CustomerEnabled":true},{"CustomerID":123,"CustomerName":"Bernard","CustomerImage":"~/Images/Customers/kb040412.gif","CustomerEnabled":true}]}}

In my markup I have

<section id="CustomerList">
    <ul data-bind: 'foreach: data'>
        Data: <span data-bind="text: JSON.stringify(ko.toJS($data), null, 2)"></span>

        <li>
            <span data-bind="text:CustomerID"></span>
        </li>
    </ul>
</section>

But I cannot get it to write out the ID’s via knockout’s databinding.

My JS to execute this process is simply:

var ViewModel = {
    Customer: []
};
dataService.getCustomers(function (data) {
    ViewModel.Customer = data.Customers;
    ko.applyBindings(ViewModel);
});

I can step into the getCustomers() callback and validate the JSON is coming back as above, and I can also query ViewModel.Customer and see the data assigned, but nothing gets written out.
I assumed this would be trivial, but nothing has worked thus far.

Any ideas?

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-01T08:13:55+00:00Added an answer on June 1, 2026 at 8:13 am

    In:

    <section id="CustomerList">
        <ul data-bind: 'foreach: data'>
            Data: <span data-bind="text: JSON.stringify(ko.toJS($data), null, 2)"></span>
    
            <li>
                <span data-bind="text:CustomerID"></span>
            </li>
        </ul>
    </section>
    

    Change:

    <ul data-bind: 'foreach: data'>
    

    To:

    <ul data-bind: 'foreach: Customer>
    

    And in:

    dataService.getCustomers(function (data) {
        ViewModel.Customer = data.Customers;
        ko.applyBindings(ViewModel);
    });
    

    Change:

    ViewModel.Customer = data.Customers;
    

    To:

    ViewModel.Customer = data.Customers.data;
    

    Finally you need to remove the debug line with the data from within the <ul> as this is invalidating the markup.

    Working sample can be viewed at http://jsfiddle.net/unklefolk/35eQQ/2/

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

Sidebar

Related Questions

I have the following JSON string coming from external input source: {value: "82363549923gnyh49c9djl239pjm01223", id:
I have the following JSON coming back: {gameId:137.0,memberId:3,id:97.0,reviewBody:Great game! Awesome.,createdAt:October, 13 2010 18:55:34} I'm
I have the following json returned to me from an API. sections: { 1:
I have a php query the returns the following JSON format from a table.
I wrote the following simple function that takes two parameters mostly coming from another
Using MVC3 I am trying to accomplish the following. I have a table which
I have a pretty nested JSON coming from a ldap_search() call. I would like
I have this dropdown (select) menu generated with JQuery, dynamically using JSON coming from
I am trying to return some JSON from a WCF service. This service simply
I have the following json string and I want to retrieve just the email

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.