code: def import_dashboards(path, recursive):
      
      p = Path(path)
      files = []
      if p.is_file():
          files.append(p)
      elif p.exists() and not recursive:
          files.extend(p.glob('*.json'))
      elif p.exists() and recursive:
          files.extend(p.rglob('*.json'))
      for f in files:
          logging.info('Importing dashboard from file %s', f)
          try:
              with f.open() as data_stream:
                  dashboard_import_export.import_dashboards(
                      db.session, data_stream)
          except Exception as e:
              logging.error('Error when importing dashboard from file %s', f)
              logging.error(e)
docs: Import dashboards from JSON