There is a similar code:

$.getJSON('http://shop-42251-50.myinsales.ru/collection/tehnika.json', function(data) { data.sort(function(a,b){ return a.data.products.id-b.data.products.id }); }); 

Writes data.sort is not a function, help me find an error or an article how json sorting is done, please.

    1 answer 1

    Good day. I think in your case it will look something like this.

     $.getJSON('http://shop-42251-50.myinsales.ru/collection/tehnika.json', function(data) { data['products'].sort(function(a, b) { return a.id - b.id; }); });