@@ -339,8 +339,10 @@ def test_DDL_autocommit(shared_instance, dbapi_database):
339339
340340@pytest .mark .skipif (_helpers .USE_EMULATOR , reason = "Emulator does not support json." )
341341def test_autocommit_with_json_data (shared_instance , dbapi_database ):
342- """Check that DDLs in autocommit mode are immediately executed for
343- json fields."""
342+ """
343+ Check that DDLs in autocommit mode are immediately
344+ executed for json fields.
345+ """
344346 # Create table
345347 conn = Connection (shared_instance , dbapi_database )
346348 conn .autocommit = True
@@ -376,6 +378,35 @@ def test_autocommit_with_json_data(shared_instance, dbapi_database):
376378 conn .close ()
377379
378380
381+ @pytest .mark .skipif (_helpers .USE_EMULATOR , reason = "Emulator does not support json." )
382+ def test_json_array (shared_instance , dbapi_database ):
383+ # Create table
384+ conn = Connection (shared_instance , dbapi_database )
385+ conn .autocommit = True
386+
387+ cur = conn .cursor ()
388+ cur .execute (
389+ """
390+ CREATE TABLE JsonDetails (
391+ DataId INT64 NOT NULL,
392+ Details JSON,
393+ ) PRIMARY KEY (DataId)
394+ """
395+ )
396+ cur .execute (
397+ "INSERT INTO JsonDetails (DataId, Details) VALUES (%s, %s)" ,
398+ [1 , JsonObject ([1 , 2 , 3 ])],
399+ )
400+
401+ cur .execute ("SELECT * FROM JsonDetails WHERE DataId = 1" )
402+ row = cur .fetchone ()
403+ assert isinstance (row [1 ], JsonObject )
404+ assert row [1 ].serialize () == "[1,2,3]"
405+
406+ cur .execute ("DROP TABLE JsonDetails" )
407+ conn .close ()
408+
409+
379410def test_DDL_commit (shared_instance , dbapi_database ):
380411 """Check that DDLs in commit mode are executed on calling `commit()`."""
381412 conn = Connection (shared_instance , dbapi_database )
0 commit comments