{"id":21318695,"url":"https://github.com/jutaz/athena-struct-parser","last_synced_at":"2025-07-12T03:31:01.892Z","repository":{"id":46323372,"uuid":"222102066","full_name":"jutaz/athena-struct-parser","owner":"jutaz","description":"Parse dict-like structs returned in responses of AWS Athena","archived":false,"fork":false,"pushed_at":"2022-09-09T21:51:31.000Z","size":71,"stargazers_count":4,"open_issues_count":4,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-13T06:30:57.501Z","etag":null,"topics":["athena","npm-package","parser"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jutaz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-11-16T13:18:05.000Z","updated_at":"2024-06-06T15:03:17.000Z","dependencies_parsed_at":"2022-09-13T08:22:16.933Z","dependency_job_id":null,"html_url":"https://github.com/jutaz/athena-struct-parser","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jutaz%2Fathena-struct-parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jutaz%2Fathena-struct-parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jutaz%2Fathena-struct-parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jutaz%2Fathena-struct-parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jutaz","download_url":"https://codeload.github.com/jutaz/athena-struct-parser/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225788340,"owners_count":17524257,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["athena","npm-package","parser"],"created_at":"2024-11-21T19:20:21.301Z","updated_at":"2024-11-21T19:20:21.775Z","avatar_url":"https://github.com/jutaz.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# athena-struct-parser\n\nA small utility to parse out structs returned by [AWS Athena](https://aws.amazon.com/athena/). Tools such as [`athena-express`](https://github.com/ghdna/athena-express) do a great job at querying Athena, however there's no easy way to get freeform JSON out of it. This tool allows one to parse the Athena's structs \u0026 Arrays into JS objects.\n\n## Problem\n\nLet's take the following code as an example:\n```js\nconst results = await athenaExpress.query('SELECT struct, foo, bar FROM my_table');\n\n// `results` is:\n// {\n//   \"Items\": [\n//     {\n//       \"struct\": \"{foo=bar, baz=[{foe=moe}]}\",\n//       \"foo\": \"baz\",\n//       \"bar\": zab\n//     }\n//   ]\n// }\n```\n\nIt's not easy to get the data out of that `struct` column, even if that's pretty common way to store data (as JSON blobs). One could try to use a rudimentary parser, but it might trip up on un-escaped characters.\n\n## Usage\n\nInstall the library via:\n```sh\nnpm i athena-struct-parser\n```\n\n```js\nimport parseStruct from 'athena-struct-parser';\n\nconst results = await athenaExpress.query('SELECT struct, foo, bar FROM my_table');\n\nresults.Items.map(result =\u003e {\n  result.struct = parseStruct(result.struct);\n  return result;\n});\n\n// `results.struct` now contains JS object with data from the struct:\n// {\n//   \"Items\": [\n//     {\n//       \"struct\": {\n//         \"foo\": \"bar\",\n//         \"baz\": [\n//           {\n//             \"foe\": \"moe\"\n//           }\n//         ]\n//       }\",\n//       \"foo\": \"baz\",\n//       \"bar\": zab\n//     }\n//   ]\n// }\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjutaz%2Fathena-struct-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjutaz%2Fathena-struct-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjutaz%2Fathena-struct-parser/lists"}