{"id":15821242,"url":"https://github.com/eomm/sqs-json-body-parser","last_synced_at":"2026-04-16T13:31:39.824Z","repository":{"id":56038277,"uuid":"316989020","full_name":"Eomm/sqs-json-body-parser","owner":"Eomm","description":"Middyjs middleware to parse your AWS SQS events","archived":false,"fork":false,"pushed_at":"2023-02-27T12:20:58.000Z","size":13,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-10-12T07:44:30.004Z","etag":null,"topics":["aws","aws-lambda","hacktoberfest","javascript","json","lambda","middleware","middy","parsing","sqs"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Eomm.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-11-29T16:04:58.000Z","updated_at":"2023-09-08T18:15:25.000Z","dependencies_parsed_at":"2024-10-26T12:47:16.448Z","dependency_job_id":"5ecd0c9c-a745-4b50-ba1c-3991546298e6","html_url":"https://github.com/Eomm/sqs-json-body-parser","commit_stats":{"total_commits":8,"total_committers":1,"mean_commits":8.0,"dds":0.0,"last_synced_commit":"b180ce6fbb7b87758b0f0e1d0173deabb37c1a15"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Eomm%2Fsqs-json-body-parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Eomm%2Fsqs-json-body-parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Eomm%2Fsqs-json-body-parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Eomm%2Fsqs-json-body-parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Eomm","download_url":"https://codeload.github.com/Eomm/sqs-json-body-parser/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246598151,"owners_count":20802973,"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":["aws","aws-lambda","hacktoberfest","javascript","json","lambda","middleware","middy","parsing","sqs"],"created_at":"2024-10-05T07:21:13.004Z","updated_at":"2026-04-16T13:31:39.786Z","avatar_url":"https://github.com/Eomm.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Middy sqs-json-body-parser middleware\n\n[![Build Status](https://github.com/Eomm/sqs-json-body-parser/workflows/ci/badge.svg)](https://github.com/Eomm/sqs-json-body-parser/actions)\n[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)\n\n\n🛵 [middyjs](https://github.com/middyjs/middy) middleware to parse your AWS SQS events' body!\nThis middleware will add to the [SQS message](./test/queue-standard.json) an additional field with the parsed body.\nIf the event is not an `SQS` event, it will be ignored.\n\n## Install\n\n```js\nnpm i sqs-json-body-parser\n```\n\n\n## Options\n\n- `throwOnFail` (boolean): define if the middleware should ignore errors when parsing the body string. **Default**: `true`\n- `attachField` (string): the name of the attached field. **Default**: `jsonBody`\n- `secureJson` (json): customize the `options` passed to [`secure-json-parse`](https://www.npmjs.com/package/secure-json-parse). If null the `JSON.parse` will be used instead to parse the body. **Default**: null\n\n⚠ `secureJson` may impact your Lambda performance! Use it only if the body input is not sanitized.\n\n## Usage\n\n```js\nconst middy = require('@middy/core')\nconst sqsJsonBodyParser = require('sqs-json-body-parser')\n\nconst handler = middy((event, context, cb) =\u003e {\n  cb(null, event.Records)\n})\n\nhandler.use(sqsJsonBodyParser({ throwOnFail: false }))\n\n// invokes the handler\nconst event = {\n  \"Records\": [\n    {\n      \"messageId\": \"11d6ee51-4cc7-4302-9e22-7cd8afdaadf5\",\n      \"receiptHandle\": \"AQEBBX8nesZEXmkhsmZeyIE8iQAMig7qw...\",\n      \"body\": \"{\\\"test\\\": \\\"foo\\\"}\",\n      \"attributes\": {\n        \"ApproximateReceiveCount\": \"1\",\n        \"SentTimestamp\": \"1573251510774\",\n        \"SequenceNumber\": \"18849496460467696128\",\n        \"MessageGroupId\": \"1\",\n        \"SenderId\": \"AIDAIO23YVJENQZJOL4VO\",\n        \"MessageDeduplicationId\": \"1\",\n        \"ApproximateFirstReceiveTimestamp\": \"1573251510774\"\n      },\n      \"messageAttributes\": {},\n      \"md5OfBody\": \"e4e68fb7bd0e697a0ae8f1bb342846b3\",\n      \"eventSource\": \"aws:sqs\",\n      \"eventSourceARN\": \"arn:aws:sqs:us-east-2:123456789012:fifo.fifo\",\n      \"awsRegion\": \"us-east-2\"\n    }\n  ]\n}\n\nhandler(event, {}, (_, records) =\u003e {\n  expect(records[0].jsonBody).toEqual({ test: 'foo' })\n})\n```\n\n## License\n\nLicensed under [MIT](./LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feomm%2Fsqs-json-body-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feomm%2Fsqs-json-body-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feomm%2Fsqs-json-body-parser/lists"}