JsonWriter
from mockalot.writers import JsonWriter
This writer materialize data as a .json
file into the file system.
Parameters
output_path (str)
The target path of the outputed json.
It defaults to ./output
output_filename (str)
The name of the outputed json.
It defaults to sample_data
.
Obs: There is no need to include the extesion (.json
) as it’s automatically set!
jsonlines (boolean)
If true, the outputed json will be a jsonlines file.
Usage
Simple
mockalot.set_writer(JsonWriter, {})
Complete
params = {
"output_path": "/path/to/file",
"output_filename": "my_json_file",
"jsonlines": True
}
mockalot.set_writer(JsonWriter, params)