Push JSON file with special chars unicode to bigquery via command line

248 Views Asked by At

Im trying to push a json file to BQ via bqcmd which contains special chars such as ü but tis failing. Ive tried differnt encoding etc. nothing workign except removing the chars

 {
    "productName": "soft drüum",
    "Category": "xxxxxxx",
    "subCategory": "Sun & Tan",
    "subSubCategory": "Sun",
    "productType": "Standard",
    "brandName": "soft drüum",
    "quantity": 1
}

Json File was successful until introduction of special chars

BQ command:

bq load --autodetect=true --time_partitioning_field date
--source_format NEWLINE_DELIMITED_JSON Data.products D:\XXXX\xx\products.json
1

There are 1 best solutions below

3
Riley Runnoe On

I would check to make sure that you have your json saved as new line delimited. In your example, the trailing comma is not valid in New Line Delimited JSON.

I was able to then upload these special characters via this command:

bq load --project_id=${project_id} --source_format NEWLINE_DELIMITED_JSON --autodetect ${database}.${table} ${nldjson_filename}