'This method parses a JSON scan result as exported using
`ivre scancli --json > file`, displays the parsing result, and
return True if everything went fine, False otherwise.
In backend-specific subclasses, this method stores the result
instead of displaying it, thanks to the `store_host`
method.'

def store_scan_json(self, fname, filehash=None, needports=False, needopenports=False, categories=None, source=None, gettoarchive=None, add_addr_infos=True, force_info=False, merge=False, **_):

    if (categories is None):
        categories = []
    scan_doc_saved = False
    self.start_store_hosts()
    with utils.open_file(fname) as fdesc:
        for line in fdesc:
            host = self.json2dbrec(json.loads(line.decode()))
            for fname in ['_id']:
                if (fname in host):
                    del host[fname]
            host['scanid'] = filehash
            if categories:
                host['categories'] = categories
            if (source is not None):
                host['source'] = source
            if (add_addr_infos and (self.globaldb is not None) and (force_info or ('infos' not in host) or (not host['infos']))):
                host['infos'] = {}
                for func in [self.globaldb.data.country_byip, self.globaldb.data.as_byip, self.globaldb.data.location_byip]:
                    data = func(host['addr'])
                    if data:
                        host['infos'].update(data)
            if (((not needports) or ('ports' in host)) and ((not needopenports) or host.get('openports', {}).get('count'))):
                while (host.get('schema_version') in self.__schema_migrations['hosts']):
                    oldvers = host.get('schema_version')
                    self.__schema_migrations['hosts'][oldvers][1](host)
                    if (oldvers == host.get('schema_version')):
                        utils.LOGGER.warning('[%r]    could    not    migrate    host    from    version    %r    [%r]', self.__class__, oldvers, host)
                        break
                if (not scan_doc_saved):
                    self.store_scan_doc({'_id': filehash})
                    scan_doc_saved = True
                if (merge and self.merge_host(host)):
                    pass
                else:
                    self.archive_from_func(host, gettoarchive)
                    self.store_host(host)
    self.stop_store_hosts()
    return True
