{"id":28418567,"url":"https://github.com/navinpeiris/json_ordered","last_synced_at":"2025-06-28T04:31:33.691Z","repository":{"id":273158347,"uuid":"918856472","full_name":"navinpeiris/json_ordered","owner":"navinpeiris","description":"A simple struct and encoder for the Elixir 1.18+ that allows you to encode JSON data with the keys in the specified order","archived":false,"fork":false,"pushed_at":"2025-01-19T04:38:04.000Z","size":14,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-04T17:52:38.777Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Elixir","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/navinpeiris.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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":"2025-01-19T03:22:06.000Z","updated_at":"2025-01-29T20:14:30.000Z","dependencies_parsed_at":"2025-01-19T04:36:05.073Z","dependency_job_id":null,"html_url":"https://github.com/navinpeiris/json_ordered","commit_stats":null,"previous_names":["navinpeiris/json_ordered"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/navinpeiris/json_ordered","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/navinpeiris%2Fjson_ordered","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/navinpeiris%2Fjson_ordered/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/navinpeiris%2Fjson_ordered/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/navinpeiris%2Fjson_ordered/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/navinpeiris","download_url":"https://codeload.github.com/navinpeiris/json_ordered/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/navinpeiris%2Fjson_ordered/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262375691,"owners_count":23301338,"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":[],"created_at":"2025-06-04T11:39:35.041Z","updated_at":"2025-06-28T04:31:33.678Z","avatar_url":"https://github.com/navinpeiris.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JSONOrdered\n\n[![CI](https://github.com/navinpeiris/json_ordered/actions/workflows/ci.yml/badge.svg)](https://github.com/navinpeiris/json_ordered/actions/workflows/ci.yml)\n[![Hex version](https://img.shields.io/hexpm/v/json_ordered.svg \"Hex version\")](https://hex.pm/packages/json_ordered)\n[![Hex downloads](https://img.shields.io/hexpm/dt/json_ordered.svg \"Hex downloads\")](https://hex.pm/packages/json_ordered)\n[![License](http://img.shields.io/:license-mit-blue.svg)](http://doge.mit-license.org)\n\nA simple struct and encoder for the Elixir 1.18+ [JSON](https://hexdocs.pm/elixir/JSON.html) module that allows you to encode JSON data with the keys in the specified order.\n\nThis is handy for external facing API's where the order of keys makes it easier to reason about the response content.\n\n## Installation\n\n```elixir\ndef deps do\n  [\n    {:json_ordered, \"~\u003e 0.1.0\"}\n  ]\nend\n```\n\n## Usage\n\nProvide the data as a keyword list to `JSONOrdered.new/1`:\n\n```elixir\nJSONOrdered.new(a: 1, b: 2, c: 3)\n```\n\nWhen the JSON module encodes the data, the order of the keys will be preserved:\n\n```json\n{\n  \"a\": 1,\n  \"b\": 2,\n  \"c\": 3\n}\n```\n\nFor example, in a Phoenix controller, you could do something like:\n\n```elixir\ndef index(conn, _params) do\n  conn\n  |\u003e json(JSONOrdered.new(\n    id: \"123\",\n    name: \"John Doe\",\n    email: \"john.doe@example.com\"\n  ))\nend\n```\n\n## Development\n\nUse the following mix task before pushing commits to run the same checks that are run in CI:\n\n```\nmix ci\n```\n\n## License\n\nThe MIT License\n\nCopyright (c) 2025-present Navin Peiris\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnavinpeiris%2Fjson_ordered","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnavinpeiris%2Fjson_ordered","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnavinpeiris%2Fjson_ordered/lists"}