(path: FilePath, data: JSONInput, indent: int = 2)
Create a .json file and dump contents or write to standard
    output.

    location (FilePath): The file path. "-" for writing to stdout.
    data (JSONInput): The JSON-serializable data to output.
    indent (int): Number of spaces used to indent JSON.
Create a .json file and dump contents or write to standard
    output.
Create a . json file and dump contents or write to standard output .
def write_json(path: FilePath, data: JSONInput, indent: int = 2) -> None:
    """Create a .json file and dump contents or write to standard
    output.

    location (FilePath): The file path. "-" for writing to stdout.
    data (JSONInput): The JSON-serializable data to output.
    indent (int): Number of spaces used to indent JSON.
    """
    json_data = json_dumps(data, indent=indent)
    if path == "-":  # writing to stdout
        print(json_data)
    else:
        file_path = force_path(path, require_exists=False)
        with file_path.open("w", encoding="utf8") as f:
            f.write(json_data)
def write_json ( path : FilePath , data : JSONInput , indent : int = 2 ) -> None : json_data = json_dumps ( data , indent = indent ) if path == "-" : # writing to stdout print ( json_data ) else : file_path = force_path ( path , require_exists = False ) with file_path . open ( "w" , encoding = "utf8" ) as f : f . write ( json_data )