Solomon Bothwell
Solomon Bothwell

Reputation: 1124

Loading multiple JSON records into BigQuery using the console

I'm trying to upload some data into bigquery in JSON format using the BigQuery Console as described here.

If I have a single record in a JSON file I can upload it successfully. If I put two or more records in a JSON file with newline delimination then I get this error:

 Error while reading data, error message: JSON parsing error in row starting at position 0: Parser terminated before end of string 

I tried searching stackoverflow and google but didn't have any luck finding any information. The two records I uploaded with newline delimination are able to upload successfully as individual records in separate JSON files.

Upvotes: 0

Views: 597

Answers (1)

Solomon Bothwell
Solomon Bothwell

Reputation: 1124

My editor must have been adding some other character on my newlines. I went back to my original json array of records and used:

cat test.json | jq -c '.[]' > testNDJSON.json

This fixed everything.

Upvotes: 1

Related Questions