def change_ls(table):
 if ('total' in table):
  for field in ['files', 'bytes']:
   if ((field in table['total']) and table['total'][field].isdigit()):
    table['total'][field] = int(table['total'][field])
 for volume in table.get('volumes', []):
  for fileentry in volume.get('files', []):
   if (('size' in fileentry) and fileentry['size'].isdigit()):
    fileentry['size'] = int(fileentry['size'])
 return table

def change_ls ( table ) : if ( 'total' in table ) : for field in [ 'files' , 'bytes' ] : if ( ( field in table [ 'total' ] ) and table [ 'total' ] [ field ] . isdigit ( ) ) : table [ 'total' ] [ field ] = int ( table [ 'total' ] [ field ] ) for volume in table . get ( 'volumes' , [ ] ) : for fileentry in volume . get ( 'files' , [ ] ) : if ( ( 'size' in fileentry ) and fileentry [ 'size' ] . isdigit ( ) ) : fileentry [ 'size' ] = int ( fileentry [ 'size' ] ) return table
adapt structured data from "ls" nse module to convert some fields to integers .