This is the dictionary I have
my_dict1 = {'jobId': dict_values(['banned_phrase_model_', 'spica_4', 'spica_create_event1', 'spica_create_event2'])}
And I am trying insert this dictionary into bigquery table after serializing to json using the code below.
from google.cloud import bigquery
import json
from pydantic.json import pydantic_encoder
client1 = Clients.get_client(ClientType.BIGQUERY, name='x')
toJSON = json.dumps(my_dict1, default=pydantic_encoder).encode("utf-8")
data = json.loads(toJSON)
err1 = client1.insert_rows(table,[data])
print(err1)
The table in bigquery is one column jobId (STRING). The error I am getting is "TypeError: Object of type 'dict_values' is not JSON serializable". I tried using the function in the stackoverflow link as well. How to serialize Python dict to JSON Still it did not work. Please let me know your thoughts. Thanks.