Looks like you need your root object to not be an array.
More like:
var creditorData = { "creditors":
[{"DebtSolutionCreditorId":3,"AccountNumber":"123456","AmountOwed":
1000,"Le nderId":48,"NameOnAgreement":"test
name","Repayment":200},{"DebtSolutionCreditorId":
4,"AccountNumber":"123456" ,"AmountOwed":6000,"LenderId":
3,"NameOnAgreement":"test
name","Repayment":200}] };
var creditorModel = ko.mapping.fromJS(creditorData);
Hope this helps.
On Feb 10, 12:17 pm, Paul Cox <
p...@houseofstraw.co.uk> wrote:
> I'm currently using Knockout to create an editable grid for my MVC
> application. This worked well until I tried to add total fields like the
> Shopping Cart Example. I wanted the total to update when the value changed
> and realised I needed my observableArray to contain observable fields.
> Previously I had been using the JS array created by the server side code
> directly to create the observableArray.
>
> However this code returns an empty array for the creditorModel using the
> knockout-1.1.2 and knockout.mapping-latest. Am I doing something silly here?
>
> var creditorData =
> [{"DebtSolutionCreditorId":3,"AccountNumber":"123456","AmountOwed":1000,"Le nderId":48,"NameOnAgreement":"test