{"id":15680156,"url":"https://github.com/sholladay/hapi-align-json","last_synced_at":"2026-05-05T05:35:05.993Z","repository":{"id":57260768,"uuid":"82666297","full_name":"sholladay/hapi-align-json","owner":"sholladay","description":"Respond with beautiful JSON","archived":false,"fork":false,"pushed_at":"2020-01-13T18:07:12.000Z","size":19,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-04-14T00:28:54.939Z","etag":null,"topics":["align","alignment","dx","hapi","indent","json","plugin"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sholladay.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-02-21T10:19:37.000Z","updated_at":"2020-01-13T18:07:15.000Z","dependencies_parsed_at":"2022-08-25T02:11:49.316Z","dependency_job_id":null,"html_url":"https://github.com/sholladay/hapi-align-json","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sholladay%2Fhapi-align-json","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sholladay%2Fhapi-align-json/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sholladay%2Fhapi-align-json/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sholladay%2Fhapi-align-json/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sholladay","download_url":"https://codeload.github.com/sholladay/hapi-align-json/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245507059,"owners_count":20626537,"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":["align","alignment","dx","hapi","indent","json","plugin"],"created_at":"2024-10-03T16:40:42.859Z","updated_at":"2026-05-05T05:35:00.963Z","avatar_url":"https://github.com/sholladay.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# hapi-align-json [![Build status for hapi Align JSON](https://travis-ci.com/sholladay/hapi-align-json.svg?branch=master \"Build Status\")](https://travis-ci.com/sholladay/hapi-align-json \"Builds\")\n\n\u003e Respond with beautiful JSON\n\n## Why?\n\n - Quick alternative to HTML in some cases.\n - Optimize your API for readability.\n - Has the best formatting.\n\n## Install\n\n```sh\nnpm install hapi-align-json\n```\n\n## Usage\n\nRegister the plugin on your server to enable beautiful JSON responses.\n\n```js\nconst hapi = require('@hapi/hapi');\nconst alignJson = require('hapi-align-json');\n\nconst server = hapi.server();\n\nconst init = async () =\u003e {\n    await server.register(alignJson);\n    server.route({\n        method : 'GET',\n        path   : '/',\n        handler() {\n            return { foo : 'bar', ping : 'pong', wee : { hi : 'bye',  tea : 'time' }, knick : 'knack', back : 'pack' };\n        }\n    });\n    await server.start();\n    console.log('Server ready:', server.info.uri);\n};\n\ninit();\n```\n\nVisiting the above route will return a JSON response with highly readable formatting because of this plugin.\n\n```json\n{\n    \"foo\"  : \"bar\",\n    \"ping\" : \"pong\",\n    \"wee\"  : {\n        \"hi\"  : \"bye\",\n        \"tea\" : \"time\"\n    },\n    \"knick\" : \"knack\",\n    \"back\"  : \"pack\"\n}\n```\n\n## Contributing\n\nSee our [contributing guidelines](https://github.com/sholladay/hapi-align-json/blob/master/CONTRIBUTING.md \"Guidelines for participating in this project\") for more details.\n\n1. [Fork it](https://github.com/sholladay/hapi-align-json/fork).\n2. Make a feature branch: `git checkout -b my-new-feature`\n3. Commit your changes: `git commit -am 'Add some feature'`\n4. Push to the branch: `git push origin my-new-feature`\n5. [Submit a pull request](https://github.com/sholladay/hapi-align-json/compare \"Submit code to this project for review\").\n\n## License\n\n[MPL-2.0](https://github.com/sholladay/hapi-align-json/blob/master/LICENSE \"License for hapi-align-json\") © [Seth Holladay](https://seth-holladay.com \"Author of hapi-align-json\")\n\nGo make something, dang it.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsholladay%2Fhapi-align-json","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsholladay%2Fhapi-align-json","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsholladay%2Fhapi-align-json/lists"}