Good day to all. I'm new to js, so I often run into problems writing scripts. In short, I have a json array of objects:
var MyJson = '[ '+ '{ "id":"Id","name":"Name","price": "Price","quantity":"Quantity"}, '+ '{ "id":"123","name":"iPhone XS","price": "1600","quantity":"10"}, '+ '{ "id":"344","name":"Samsung Galaxy S7","price": "550","quantity":"7"}, '+ '{ "id":"266","name":"Macbook","price": "900","quantity":"7"},'+ '{ "id":"478","name":"Asus","price": "400","quantity":"8"}, '+ '{ "id":"569","name":"Acer","price": "300","quantity":"4"}, '+ '{ "id":"788","name":"TP-LINK","price": "100","quantity":"10"}, '+ '{ "id":"124","name":"iPhone SE","price": "350","quantity":"11"}, '+ '{ "id":"345","name":"Samsung Galaxy Note Boom","price": "690","quantity":"8"}, '+ '{ "id":"267","name":"Surface Boom","price": "690","quantity":"8"}'+ ']'; There was a need to sort the objects, say by id. Can you please tell someone how to junk it up with Javascript.
var Myobj = JSON.parse(MyJson);describe the function to sort, and use the sort method - Vladimir Klykov