I'm converting a CSV file into JSON like this:
import os
import csv
import json
with open(args.infile, encoding="utf-8") as csv_file:
csv_rows = list(csv.DictReader(csv_file))
with open(args.outfile, "w", encoding="utf-8") as json_file:
json.dump(csv_rows, json_file, ensure_ascii=False, indent=2)
The CSV file contains a column which can have the values "true"
and "false"
as strings. These shall be mapped to the JSON as true
and false
(not in the Python style of True
or False
).
Is there a built-in function which I can use?