Edit in plunkr
Steps involved
- Loop through the JSON object
- Specify the properties which needs to be filtered
<div class="mydiv"> <textarea cols="100" rows="15" class="txtarea" id="txt">[{"Blog Name":"PrathapKudupusBlog","Date":"30 Jul 2013 09:24 AM","Type":"Technical","Author":"Prathap Kudupu"},{"Blog Name":"ABCBlog","Date":"30 Jul 2011 09:24 AM", "Type":"Technical","Author":"ABC"},{"Blog Name":"XYZBlog","Date":"30 Jul 2011 09:24 AM","Type":"Technical","Author":"XYZ"}]</textarea> <button class="download">Download CSV</button> </div> <script> $(document).ready(function(){ $('button').click(function(){ var data = $('#txt').val(); for (var i = 0; i < data.length; i++) { delete data[i]["Date"]; } JSONToCSVConvertor(data, "Blog report", true); }); }); </script>
Before
No comments:
Post a Comment