Import CSV file with JSON object
Hello,
I would like to import a CSV file with a JSON object. This is an example of how my CSV file looks like:
pizzaID, type
1, {"cheese": 0, "pepperoni": 0, "hawaiian": 1}
2, {"cheese": 0, "pepperoni": 1, "hawaiian": 0}
3, {"cheese": 1, "pepperoni": 0, "hawaiian": 0}
When I try importing this CSV file into MySQL workbench, this is the error I get:
mysql> load data local infile 'testJSON.csv' into table testJSON fields terminated by ',' enclosed by '"' lines terminated by '\n' (pizzaID, type);
ERROR 3140 (22032): Invalid JSON text: "Missing a comma or '}' after an object member." at position 12 in value for column 'testJSON.type'.
Any idea on how to resolve this issue? Will I need to change some formatting in my CSV file?
Any help is much appreciated! Thanks!