{"id":19106529,"url":"https://github.com/suddengunter/edynamojson","last_synced_at":"2026-05-08T03:47:18.088Z","repository":{"id":260523435,"uuid":"881540637","full_name":"SuddenGunter/edynamojson","owner":"SuddenGunter","description":"Erlang DynamoDB JSON serializer/deserializer","archived":false,"fork":false,"pushed_at":"2024-11-09T00:11:58.000Z","size":42,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-22T10:19:49.453Z","etag":null,"topics":["aws","dynamodb","erlang","json","serialization"],"latest_commit_sha":null,"homepage":"","language":"Erlang","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/SuddenGunter.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":"2024-10-31T19:21:44.000Z","updated_at":"2025-02-04T01:05:45.000Z","dependencies_parsed_at":"2025-01-03T02:51:09.828Z","dependency_job_id":"b15132fd-52cf-4762-9029-caef5357f250","html_url":"https://github.com/SuddenGunter/edynamojson","commit_stats":null,"previous_names":["suddengunter/edynamojson"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/SuddenGunter/edynamojson","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SuddenGunter%2Fedynamojson","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SuddenGunter%2Fedynamojson/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SuddenGunter%2Fedynamojson/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SuddenGunter%2Fedynamojson/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SuddenGunter","download_url":"https://codeload.github.com/SuddenGunter/edynamojson/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SuddenGunter%2Fedynamojson/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279098054,"owners_count":26102951,"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","status":"online","status_checked_at":"2025-10-15T02:00:07.814Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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","dynamodb","erlang","json","serialization"],"created_at":"2024-11-09T04:08:33.658Z","updated_at":"2025-10-15T17:55:57.734Z","avatar_url":"https://github.com/SuddenGunter.png","language":"Erlang","funding_links":[],"categories":[],"sub_categories":[],"readme":"# edynamojson\n\nErlang DynamoDB JSON serializer/deserializer.\n\n\nThis library is primarily designed for use with [aws-beam](https://github.com/aws-beam/aws-erlang/tree/master/src). Since aws-beam automatically handles JSON serialization and deserialization, this library allows to just convert Erlang term to DynamoDB-styled Erlang term (and back).\n\nUse `serialize_term/1` and `deserialize_term/1` for aws-beam or custom JSON serializers. Use `serialize_json/1` and `deserialize_json/1` for everything else.\n\n## What?\n\nDynamoDB does not allow you to just store objects like `{\"id\": \"ABC\"}`; it will always ask you to add type annotations like `{\"id\": {\"S\": \"ABC\"}}`.\n\nThis library does this automatically - so you don't have to.\n\n## Examples \n\nSerialization and write to DynamoDB with aws-beam:\n\n```erl\nModel = #{\u003c\u003c\"id\"\u003e\u003e =\u003e \u003c\u003c\"secret_id\"\u003e\u003e,\n          \u003c\u003c\"created_at\"\u003e\u003e =\u003e 123,\n          \u003c\u003c\"embedded_map\"\u003e\u003e =\u003e #{\u003c\u003c\"foo\"\u003e\u003e =\u003e \u003c\u003c\"bar\"\u003e\u003e}},\n\n% returns term: #{\u003c\u003c\"id\"\u003e\u003e: {\u003c\u003c\"S\"\u003e\u003e: \u003c\u003c\"secret_id\"\u003e\u003e}..}\u003e\u003e\nSerializedModel = edynamojson:serialize_term(Model),\n\nClient = aws_client:make_client(AWSKey, AWSSecKey, AWSReg),\n\nData =  aws_dynamodb:put_item(Client, #{\u003c\u003c\"TableName\"\u003e\u003e =\u003e \u003c\u003c\"testdb\"\u003e\u003e,\u003c\u003c\"Item\"\u003e\u003e =\u003e SerializedModel}),\n\n```\n\nSerialization and write to DynamoDB with custom AWS client:\n\n```erl\nModel = #{\u003c\u003c\"id\"\u003e\u003e =\u003e \u003c\u003c\"secret_id\"\u003e\u003e,\n          \u003c\u003c\"created_at\"\u003e\u003e =\u003e 123,\n          \u003c\u003c\"embedded_map\"\u003e\u003e =\u003e #{\u003c\u003c\"foo\"\u003e\u003e =\u003e \u003c\u003c\"bar\"\u003e\u003e}},\n\n% returns JSON as binary: \u003c\u003c\"{\\\"id\\\": { \\\"S\\\": \\\"secret_id\\\"}..}\u003e\u003e\nSerializedModel = edynamojson:serialize_json(Model),\n\nmy_dynamodb_client:put_item(SerializedModel),\n\n```\n\nDeserialization of data returned by aws-beam:\n\n```erl\nClient = aws_client:make_client(AWSKey, AWSSecKey, AWSReg),\n\nData =  aws_dynamodb:get_item(Client, #{\u003c\u003c\"TableName\"\u003e\u003e =\u003e \u003c\u003c\"testdb\"\u003e\u003e,\u003c\u003c\"Key\"\u003e\u003e =\u003e Key}),\n\nTerm = edynamojson:deserialize_term(Data),\n\n```\n\nDeserialization of raw dynamoDB JSON:\n\n```erl\n\n% returns #{\u003c\u003c\"A\"\u003e\u003e =\u003e \u003c\u003c\"B\"\u003e\u003e}\nResult = edynamojson:deserialize_json(\u003c\u003c\"{\\\"A\\\":{\\\"S\\\":\\\"B\\\"}}\"\u003e\u003e),\n\n```\n\n## FAQ\n\n1. Why provide `serialize_term/1` / `deserialize_term/1` ?\n\n- the main use case for this library is to be a convenience utility for aws-beam, which already does JSON serialization/deserialization\n- you might want to use some specific JSON library, so I don't want this package to have another dependency that you don't need\n\n2. Which Erlang types are supported?\n\n| Erlang type | Support |\n| -------- | ------- |\n| Binary | OK     |\n| Number    | OK    |\n| List   | OK    |\n| Map    | OK    |\n| Boolean    | OK    |\n| String | Treated as a Lists of numbers |\n| Tuple | OK (as map+list) |\n| Function | - |\n| Atom  | OK (as map+binary) |\n| Record | OK (as tuple and atom) |\n| PID | - |\n| Reference | - |\n| Everything else | Untested |\n\n- Undefined behaviour will happen if you try to use untested types in production. If you really want to do it - test it meticulously.\n- Tuple `{1, 2, 3}` is serialized as `#{\u003c\u003c\"M\"\u003e\u003e =\u003e #{\u003c\u003c\"__tuple__\"\u003e\u003e =\u003e #{ \u003c\u003c\"L\"\u003e\u003e =\u003e [...dynamodb encoded numbers...]}}}`\n- **Atoms are only allowed as field values**, never as maps keys. Atom `abc` will be serialized as `#{\u003c\u003c\"M\"\u003e\u003e =\u003e #{\u003c\u003c\"__atom__\"\u003e\u003e =\u003e #{\u003c\u003c\"S\"\u003e\u003e =\u003e \u003c\u003c\"abc\u003e\u003e}}}`. `null` atom is a special case that allows us to support DynamoDB's NULL type, so it will be serialized as `#{\u003c\u003c\"NULL\"\u003e\u003e =\u003e true}`.\n\n3. Which DynamoDB types are supported?\n\n| DynamoDB type | Serialize | Deserialize |\n| -------- | ------- | ------- |\n| S | OK | OK |\n| N | OK | OK |\n| M | OK | OK |\n| L | OK | OK |\n| BOOL | OK | OK |\n| NULL | OK* | OK* |\n| NS, SS, BS | - | OK |\n| B | - | OK |\n\n*to represent DynamoDB's NULL in erlang we use `null` atom, like say `#{\u003c\u003c\"A\"\u003e\u003e =\u003e null}` is serialized into `#{\u003c\u003c\"A\"\u003e\u003e =\u003e #{\u003c\u003c\"NULL\"\u003e\u003e =\u003e true}}`\n\n## TODO:\n\n- Elixir/Gleam examples\n- benchmarks + optimizations (potentially can remove some validations to improve performance)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsuddengunter%2Fedynamojson","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsuddengunter%2Fedynamojson","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsuddengunter%2Fedynamojson/lists"}