Root Object Cannot be Scalar Parsing Error

Hi all,

For some reason I am getting this error whenever I try to convert a CSV to a JSON with the sample data given by dremio:

“Failure while parsing JSON. Found token of [VALUE_STRING]. Dremio currently only supports parsing json strings that contain either lists or maps. The root object cannot be a scalar.”

This happens every time I try to convert almost anything from one format to another. Can someone help me with this? Thanks.

Hi @shawnb,

The formatting window is used to parse the data according to the files format. So if you have a CSV file and you try to parse/format it as a JSON file, it will give this error (though it would be nice to have a more descriptive error).

So when you promote (format) a CSV file, just choose "Text (delimited) and comma for the delimiter:

Or am I misunderstanding your problem?

Hi @ben thank you for responding. I see what you mean now but if I wanted to transform a CSV file into a JSON format how would I do that? I thought the way I was doing it was the way to transform files? Thanks and if I need to clarify anything please let me know, I am new here and am kind of bad at wording questions sometimes. Thanks!

Hi @shawnb,

If you want to transform the file into JSON format for export to another tool you can do this in Dremio, provided that the file is not too large (a few thousand rows should be ok). Add the CSV file and format it as a CSV file. Then go to this data set in Dremio, run a SELECT * FROM you.table and use the export tool to download the set in a different format (JSON in your case).