<html> <head> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"> </script> <script> var d1; var mt ={}; var md ={}; $(function() { $.getJSON('/test.txt', function(data) { d1=data; for (let i = 0; i < d1.length; i++) { let ob=d1[i]; for (prop in ob) { if (!mt[prop]){ mt[prop]=0; md[prop]=""; } if (mt[prop] < ob[prop].length){ let s=ob[prop]; mt[prop]= s.length; md[prop]= s; } // console.log(prop + "has value: " + ob[prop]); } } for (prop in mt) { var tblRow = "<tr>" + "<td>" + prop + "</td>" + "<td>" + mt[prop] + "</td>" + "<td>" + md[prop] + "</td>" + "</tr>" $(tblRow).appendTo("#userdata tbody"); } }); }); </script> </head> <body> <div class="wrapper"> <div class="profile"> <table id= "userdata" border="2"> <thead> <th>field name </th> <th>max length</th> <th>example</th> </thead> <tbody> </tbody> </table> </div> </div> </body> </html>
Wednesday
create report with max length of elements in json array
this script will create table of max length of array fields in test.txt json file.
Subscribe to:
Post Comments (Atom)
imagemagic add text to image
rem different types of text annotations on existing images rem cyan yellow orange gold rem -gravity SouthWest rem draw text and anno...
-
Error:The element 'Schedule' has invalid child element 'RecurrenceRule'. List of possible elements expected: 'Occurring&...
-
Perfect blog post must include following elements (from 1 to 13): 1.Big catchy header in 30px font size 2.First copy of social links and com...
-
SetKeyDelay , 75 , 75 ;Exits AutoHotKey application. $^CapsLock:: ExitApp return ;Pauses AutoHotKey Script. F6:: Pause , Toggle, 1 $x:: ...
No comments:
Post a Comment