def write_json_to_file(json_data, filename="metadata"):
    """
    Write all JSON in python dictionary to a new json file.
    :param dict json_data: JSON data
    :param str filename: Target filename (defaults to 'metadata.jsonld')
    :return None:
    """
    logger_jsons.info("enter write_json_to_file")
    json_data = rm_empty_fields(json_data)
    # Use demjson to maintain unicode characters in output
    json_bin = demjson.encode(json_data, encoding='utf-8', compactly=False)
    # Write json to file
    try:
        open("{}.jsonld".format(filename), "wb").write(json_bin)
        logger_jsons.info("wrote data to json file")
    except FileNotFoundError as e:
        print("Error: Writing json to file: {}".format(filename))
        logger_jsons.debug("write_json_to_file: FileNotFound: {}, {}".format(filename, e))
    logger_jsons.info("exit write_json_to_file")
    return
Write all JSON in python dictionary to a new json file.
    :param dict json_data: JSON data
    :param str filename: Target filename (defaults to 'metadata.jsonld')
    :return None: