{"id":13482854,"url":"https://github.com/crepe/jsonite","last_synced_at":"2025-03-27T13:32:49.400Z","repository":{"id":56879557,"uuid":"11781054","full_name":"crepe/jsonite","owner":"crepe","description":"A tiny, HAL-compliant JSON presenter for your Ruby APIs.","archived":false,"fork":false,"pushed_at":"2015-05-08T15:56:29.000Z","size":570,"stargazers_count":28,"open_issues_count":3,"forks_count":2,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-19T17:15:35.172Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/crepe.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-07-31T03:00:48.000Z","updated_at":"2019-10-01T04:11:53.000Z","dependencies_parsed_at":"2022-08-20T22:30:53.925Z","dependency_job_id":null,"html_url":"https://github.com/crepe/jsonite","commit_stats":null,"previous_names":["barrelage/jsonite"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crepe%2Fjsonite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crepe%2Fjsonite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crepe%2Fjsonite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crepe%2Fjsonite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/crepe","download_url":"https://codeload.github.com/crepe/jsonite/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245854700,"owners_count":20683399,"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":"2024-07-31T17:01:06.109Z","updated_at":"2025-03-27T13:32:49.119Z","avatar_url":"https://github.com/crepe.png","language":"Ruby","readme":"# Jsonite [![Build Status][1]][2]\n\nA tiny, [HAL-compliant][3] JSON presenter.\n\n[1]: http://img.shields.io/travis/crepe/jsonite.svg?style=flat\n[2]: https://travis-ci.org/crepe/jsonite\n[3]: http://tools.ietf.org/html/draft-kelly-json-hal-05\n\n## Install\n\n``` rb\n# Gemfile\ngem 'jsonite'\n```\n\n## Example\n\n``` rb\n# todo_presenter.rb\nclass TodoPresenter \u003c Jsonite\n  property :description\nend\n```\n\n``` rb\n# user_presenter.rb\nrequire 'todo_presenter'\n\nclass UserPresenter \u003c Jsonite\n  property :id\n  property :email\n\n  embed :todos, with: TodoPresenter\n\n  link do |context|\n    context.user_url self\n  end\nend\n```\n\n``` rb\n# users_presenter.rb\nrequire 'user_presenter'\n\nclass UsersPresenter \u003c Jsonite\n  property :count\n\n  embed :users, with: UserPresenter do |context|\n    self\n  end\nend\n```\n\n``` rb\n# users_controller.rb\nrequire 'users_presenter'\nrequire 'user_presenter'\n\nclass UsersController \u003c ApplicationController\n  def index\n    users = User.all\n    render json: UsersPresenter.new(users, context: self)\n  end\n  # {\n  #   \"count\": 12,\n  #   \"_embedded\": {\n  #     \"users\": [\n  #       # ...\n  #     ]\n  #   }\n  # }\n\n  def show\n    user = User.find params[:id]\n    render json: UserPresenter.new(user, context: self)\n  end\n  # {\n  #   \"id\": \"8oljbpyjetu8\",\n  #   \"email\": \"stephen@example.com\",\n  #   \"_embedded\": {\n  #     \"todos\": [\n  #       {\n  #         \"description\": \"Buy milk\"\n  #       }\n  #     ]\n  #   },\n  #   \"_links\": {\n  #     \"self\":{\n  #       \"href\": \"http://example.com/users/8oljbpyjetu8\"\n  #     }\n  #   }\n  # }\nend\n```\n\n## License\n\n(The MIT License)\n\n© 2013–2014 Stephen Celis \u003cstephen@stephencelis.com\u003e, Evan Owen \u003ckainosnoema@gmail.com\u003e\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the “Software”), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","funding_links":[],"categories":["Ruby","API Builder and Discovery"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrepe%2Fjsonite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcrepe%2Fjsonite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrepe%2Fjsonite/lists"}