Hi, yes JavaScript delete operator will do the trick. But it will keep the array length as the same after deletion. So watch out for that.
Thanks and Regards On Tue, Aug 19, 2014 at 3:24 PM, Buddhima Wijeweera <[email protected]> wrote: > Hi, > > Hope following example will give you the answer: > > <% > var e = { > "employees": [ > { > "id": "1", > "name": "Kasun", > "age": "25", > "town": "Galle", > "salary": "40000" > }, > { > "id": "3", > "name": "Sunil", > "age": "29", > "town": "Colombo", > "salary": "20000" > }, > { > "id": "4", > "name": "Rani", > "age": "32", > "town": "Kandy", > "salary": "60000" > } > > ] > > }; // Initial array > > delete e.employees[0] // Delete first element > > print(e); // Print array > > %> > > Which results: > {"employees" : [{"id" : "3", "name" : "Sunil", "age" : "29", "town" : > "Colombo", "salary" : "20000"}, {"id" : "4", "name" : "Rani", "age" : "32", > "town" : "Kandy", "salary" : "60000"}]} > > > > > On Tue, Aug 19, 2014 at 2:57 PM, Thushara Ranawaka <[email protected]> > wrote: > >> >> >> ---------- Forwarded message ---------- >> From: Thushara Ranawaka <[email protected]> >> Date: Tue, Aug 19, 2014 at 2:56 PM >> Subject: How to delete json element using Jaggery? >> To: WSO2 Training Group <[email protected]>, Waruna De Silva < >> [email protected]>, [email protected] >> >> >> Hi, >> As per the fast track training for the new employees in the 6.a.ii we >> need to develop a jaggery app, that deal with JSON data formats. Therefore >> I found this article[1] and followed it. Now I need to add a new feature >> which is to delete this json elements one by one. I logged a question in >> stackoverflow[2] as well but no one is answering it. Could some one help me >> on this. >> >> Kindly refer the stackoverflow question for more information. >> >> 1. >> >> [1] >> http://blog.lasindu.com/2014/05/how-to-write-wso2-jaggery-application.html >> <http://www.google.com/url?q=http%3A%2F%2Fblog.lasindu.com%2F2014%2F05%2Fhow-to-write-wso2-jaggery-application.html&sa=D&sntz=1&usg=AFQjCNHkm7jAgXBGXMs_wTQv6x7lpmhrUw> >> [2] >> http://stackoverflow.com/questions/25304255/how-to-delete-json-element-using-jaggery >> >> >> <http://www.google.com/url?q=http%3A%2F%2Fblog.lasindu.com%2F2014%2F05%2Fhow-to-write-wso2-jaggery-application.html&sa=D&sntz=1&usg=AFQjCNHkm7jAgXBGXMs_wTQv6x7lpmhrUw> >> -- >> Thushara Kasun Ranawaka >> Software Engineer >> WSO2 Inc.; <http://wso2.com/> >> lean.enterprise.middleware >> Mobile : *+94 (0) 773438949* >> *[email protected] <[email protected]>* >> >> >> >> -- >> Thushara Kasun Ranawaka >> Software Engineer >> WSO2 Inc.; <http://wso2.com/> >> lean.enterprise.middleware >> Mobile : *+94 (0) 773438949* >> *[email protected] <[email protected]>* >> >> _______________________________________________ >> Dev mailing list >> [email protected] >> http://wso2.org/cgi-bin/mailman/listinfo/dev >> >> > > > -- > Buddhima Wijeweera > Software Engineer; WSO2 Inc.; http://wso2.com , > > Email: [email protected] > Blog: https://buddhimawijeweera.wordpress.com > GitHub Profile: https://github.com/Buddhima > > _______________________________________________ > Dev mailing list > [email protected] > http://wso2.org/cgi-bin/mailman/listinfo/dev > > -- Software Engineer WSO2 Inc.; http://wso2.com <http://www.google.com/url?q=http%3A%2F%2Fwso2.com&sa=D&sntz=1&usg=AFQjCNEZvyc0uMD1HhBaEGCBxs6e9fBObg> lean.enterprise.middleware mobile: *+94728671315*
_______________________________________________ Dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/dev
