{"id":23249521,"url":"https://github.com/wizardone/jsup","last_synced_at":"2025-07-28T01:34:42.674Z","repository":{"id":56879654,"uuid":"89395922","full_name":"wizardone/jsup","owner":"wizardone","description":"A fast json builder for your apis, using Oj.","archived":false,"fork":false,"pushed_at":"2017-10-10T17:08:26.000Z","size":18,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-07-01T17:16:53.879Z","etag":null,"topics":["encoding","fast","json","ruby","simple"],"latest_commit_sha":null,"homepage":"","language":"Ruby","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/wizardone.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-04-25T18:55:36.000Z","updated_at":"2018-02-05T12:47:44.000Z","dependencies_parsed_at":"2022-08-20T22:31:26.087Z","dependency_job_id":null,"html_url":"https://github.com/wizardone/jsup","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/wizardone/jsup","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wizardone%2Fjsup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wizardone%2Fjsup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wizardone%2Fjsup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wizardone%2Fjsup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wizardone","download_url":"https://codeload.github.com/wizardone/jsup/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wizardone%2Fjsup/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267442458,"owners_count":24087803,"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-07-27T02:00:11.917Z","response_time":82,"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":["encoding","fast","json","ruby","simple"],"created_at":"2024-12-19T08:19:48.518Z","updated_at":"2025-07-28T01:34:42.631Z","avatar_url":"https://github.com/wizardone.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Jsup\n[![Build Status](https://travis-ci.org/wizardone/jsup.svg?branch=master)](https://travis-ci.org/wizardone/jsup)\n[![codecov](https://codecov.io/gh/wizardone/jsup/branch/master/graph/badge.svg)](https://codecov.io/gh/wizardone/jsup)\n\nJsup produces json using oj. It is really fast, simple and reliable. If\nspeed is what you are looking for in your APIs then you should check it\nout.\nIf you have a complex architecture you should probably check gems like\n`roar`, `jbuilder`, `serializers` etc.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'jsup'\n```\n\nAnd then execute:\n\n`bundle`\n\nOr install it yourself as:\n\n`gem install jsup`\n\n## Usage\n```ruby\nuser = User.first\nJsup.produce do |j|\n  j.name user.name\n  j.email user.email\nend\n```\nWill produce:\n```json\n{\n  \"name\": \"John\",\n  \"email\": \"john@johnson.com\"\n}\n```\n\n```ruby\nJsup.produce do |j|\n  j.name 'Stefan'\n  j.fetch(@address, :city)\nend\n```\nWill produce:\n```json\n{\n  \"name\": \"Stefan\",\n  \"city\": \"Sofia\"\n}\n```\nYou can fetch multiple attributes:\n```ruby\nj.fetch(@address, :city, :zip_code, :street)\n```\n\nYou can also produce nested content:\n```ruby\nJsup.produce do |j|\n  j.name 'Stefan'\n  j.address do |ja|\n    ja.street '13 march'\n    ja.city 'Sofia'\n  end\nend\n```\nWill produce:\n```json\n{\n  \"name\": \"Stefan\",\n  \"address\":\n    {\n      \"street\": \"13 march\",\n      \"city\": \"Sofia\"\n    }\n}\n```\nIf you want to extract from a hash it is also possible:\n```ruby\nJsup.produce do |j|\n  j.fetch({first: 'my', last: 'initial'}, :first, :last)\nend\n```\n```json\n{\n  \"first\": \"my\",\n  \"last\": \"initial\"\n}\n```\n\n## Benchmarking\nFor rather simple data structures jsup is way faster than jbuilder:\n```ruby\ndef jb\n  Jbuilder.encode do |person|\n    person.name 'Stefan'\n    person.email 'test@test.com'\n    person.address 'some'\n  end\nend\n\ndef js\n  Jsup.produce do |person|\n    person.name 'Stefan'\n    person.email 'test@test.com'\n    person.address 'some'\n  end\nend\n\n\nBenchmark.bm do |x|\n  x.report('jbuilder') { 10000.times { jb } }\n  x.report('jsup') { 10000.times { js } }\nend\n```\nResults:\n```shell\nuser     system      total        real\njbuilder  0.110000   0.000000   0.110000 (  0.112200)\njsup  0.030000   0.000000   0.030000 (  0.025732)\n```\n\n### I am welcoming ideas about new features and options for jsup! If you have any, let me know!\n\n\n## Development\n\n  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\n  To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\n  Bug reports and pull requests are welcome on GitHub at https://github.com/wizardone/jsup. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.\n\n\n## License\n\n  The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwizardone%2Fjsup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwizardone%2Fjsup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwizardone%2Fjsup/lists"}