Title: JsonObject does not expose array values · Issue #1455 · googleapis/python-spanner · GitHub
Open Graph Title: JsonObject does not expose array values · Issue #1455 · googleapis/python-spanner
X Title: JsonObject does not expose array values · Issue #1455 · googleapis/python-spanner
Description: Thanks for stopping by to let us know something could be better! PLEASE READ: If you have a support contract with Google, please create an issue in the support console instead of filing on GitHub. This will ensure a timely response. Plea...
Open Graph Description: Thanks for stopping by to let us know something could be better! PLEASE READ: If you have a support contract with Google, please create an issue in the support console instead of filing on GitHub. ...
X Description: Thanks for stopping by to let us know something could be better! PLEASE READ: If you have a support contract with Google, please create an issue in the support console instead of filing on GitHub. ...
Opengraph URL: https://github.com/googleapis/python-spanner/issues/1455
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"JsonObject does not expose array values","articleBody":"Thanks for stopping by to let us know something could be better!\n\n**PLEASE READ**: If you have a support contract with Google, please create an issue in the [support console](https://cloud.google.com/support/) instead of filing on GitHub. This will ensure a timely response.\n\nPlease run down the following list and make sure you've tried the usual \"quick fixes\":\n\n - Search the issues already opened: https://github.com/googleapis/python-spanner/issues ✅ \n - Search StackOverflow: https://stackoverflow.com/questions/tagged/google-cloud-platform+python ✅ \n\nIf you are still having issues, please be sure to include as much information as possible:\n\n#### Environment details\n\n - OS type and version:\n - Python version: 3.10\n - pip version: 25.2\n - `google-cloud-spanner` version: 3.55.0\n\n#### Steps to reproduce\n\n 1. Have a Json column in Spanner with schema like e.g. {\"a\": 1, \"b\": [2,3]} \n 2. execute SQL selecting field b\n 3. Attempt to index into the array contained by b\n 4. error raised\n\n#### Code example\n\n```python\nwith my_database.snapshot() as snapshot:\n result = snapshot.execute_sql(\"SELECT JSON_QUERY(my_json_col, '$.\"b\"') as b_col\nisinstance(b_col, google.cloud.spanner_v1.data_types.JsonObject) # True\nb_col[0] # raises error \n```\n\n#### Stack trace\n```\nTraceback (most recent call last):\n File \"\u003cstring\u003e\", line 1, in \u003cmodule\u003e\nKeyError: 0\n```\n\nBasically, I see that holding arrays is seen as possible in JsonObject (https://github.com/googleapis/python-spanner/blob/9535e5e096f6ab53f2817af4fd7ac1fa2ca71660/google/cloud/spanner_v1/data_types.py#L34), and is successfully serialized, but you cannot index into it, if you have need to transform the data in code.\n\n_____________\nMaking sure to follow these steps will guarantee the quickest resolution possible.\n\nThanks!\n","author":{"url":"https://github.com/ajrock","@type":"Person","name":"ajrock"},"datePublished":"2025-11-07T14:13:13.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/1455/python-spanner/issues/1455"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:b78e422e-c8c9-aaee-518f-28a90c6b89fd |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BA5C:272E5B:40CEC9:589586:69774DA7 |
| html-safe-nonce | 600e288ad9035de73757e7dcda27ef7e0f1b09fe9ebc29dccb4c9a1fc217946f |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCQTVDOjI3MkU1Qjo0MENFQzk6NTg5NTg2OjY5Nzc0REE3IiwidmlzaXRvcl9pZCI6IjU1MTkzNzk4NDI5ODMyMTg1OTkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | e2ef65a62122a44c07b9a4198f7e7f91ded066f824e17c135efa7a5d88e4137e |
| hovercard-subject-tag | issue:3600537434 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/googleapis/python-spanner/1455/issue_layout |
| twitter:image | https://opengraph.githubassets.com/fdc594ddf3b112665494edad9c528eca3481597235a6354e75db1adb9ea4762d/googleapis/python-spanner/issues/1455 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/fdc594ddf3b112665494edad9c528eca3481597235a6354e75db1adb9ea4762d/googleapis/python-spanner/issues/1455 |
| og:image:alt | Thanks for stopping by to let us know something could be better! PLEASE READ: If you have a support contract with Google, please create an issue in the support console instead of filing on GitHub. ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | ajrock |
| hostname | github.com |
| expected-hostname | github.com |
| None | 3310064f35a62c06a4024ba37f41c06836f39376a095c2dfd2c4b693c34965be |
| turbo-cache-control | no-preview |
| go-import | github.com/googleapis/python-spanner git https://github.com/googleapis/python-spanner.git |
| octolytics-dimension-user_id | 16785467 |
| octolytics-dimension-user_login | googleapis |
| octolytics-dimension-repository_id | 226992630 |
| octolytics-dimension-repository_nwo | googleapis/python-spanner |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 226992630 |
| octolytics-dimension-repository_network_root_nwo | googleapis/python-spanner |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 67d5f8d1d53c3cc4f49fc3bb8029933c3dc219e6 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width