{"id":18644743,"url":"https://github.com/hjson/hjson-rb","last_synced_at":"2025-04-11T12:31:08.962Z","repository":{"id":56876479,"uuid":"64304175","full_name":"hjson/hjson-rb","owner":"hjson","description":"Hjson for Ruby","archived":false,"fork":false,"pushed_at":"2019-06-27T22:44:25.000Z","size":31,"stargazers_count":24,"open_issues_count":4,"forks_count":6,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-03T11:42:13.970Z","etag":null,"topics":["hjson","maintainer-wanted","ruby"],"latest_commit_sha":null,"homepage":"https://hjson.github.io/","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/hjson.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-07-27T11:48:12.000Z","updated_at":"2024-11-01T04:48:45.000Z","dependencies_parsed_at":"2022-08-20T11:30:44.622Z","dependency_job_id":null,"html_url":"https://github.com/hjson/hjson-rb","commit_stats":null,"previous_names":["namusyaka/hjson"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hjson%2Fhjson-rb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hjson%2Fhjson-rb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hjson%2Fhjson-rb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hjson%2Fhjson-rb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hjson","download_url":"https://codeload.github.com/hjson/hjson-rb/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248401945,"owners_count":21097328,"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":["hjson","maintainer-wanted","ruby"],"created_at":"2024-11-07T06:13:26.961Z","updated_at":"2025-04-11T12:31:08.632Z","avatar_url":"https://github.com/hjson.png","language":"Ruby","readme":"# Hjson, the Human JSON written in Ruby\n\n[![Build Status](https://img.shields.io/travis/hjson/hjson-rb.svg?style=flat-square)](http://travis-ci.org/hjson/hjson-rb)\n[![gem](https://img.shields.io/gem/v/hjson.svg?style=flat-square)](https://rubygems.org/gems/hjson)\n[![License](https://img.shields.io/github/license/hjson/hjson-rb.svg?style=flat-square)](https://github.com/hjson/hjson-rb/blob/master/LICENSE.txt)\n\nA configuration file format for humans. Relaxed syntax, fewer mistakes, more comments for Ruby.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'hjson'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install hjson\n\n## Usage\n\nYou can use Hjson as `JSON.parse` of standard library.\n\nPlease check it out.\n\n```ruby\nrequire 'hjson'\n\nhjson = \u003c\u003cHJSON\n// for your config\n// use #, // or /**/ comments,\n// omit quotes for keys\nkey: 1\n// omit quotes for strings\nstring: contains everything until LF\n// omit commas at the end of a line\ncool: {\n  foo: 1\n  bar: 2\n}\n// allow trailing commas\nlist: [\n  1,\n  2,\n]\n// and use multiline strings\nrealist:\n  '''\n  My half empty glass,\n  I will fill your empty half.\n  Now you are half full.\n  '''\nHJSON\n\nHjson.parse(hjson)\n```\n\n### Comments\n\nHjson allows you to use comments in your JSON.\n\n```ruby\nrequire 'hjson'\n\nhjson =\u003c\u003cHJSON\n{\n  # specify rate in requests/second\n  \"rate\": 1000\n\n  // prefer c-style comments?\n  /* feeling old fashioned? */\n}\nHJSON\n\nHjson.parse(hjson) #=\u003e {\"rate\"=\u003e1000}\n```\n\n### Quotes\n\nYou don't need to quote keyname.\n\n```ruby\nrequire 'hjson'\n\nhjson =\u003c\u003cHJSON\n{\n  key: \"value\"\n}\nHJSON\n\nHjson.parse(hjson) #=\u003e {\"key\"=\u003e\"value\"}\n```\n\n### Commas\n\nYou can forget the comma at the end, Hjson recognizes the end automatically.\n\n\n```ruby\nrequire 'hjson'\n\nhjson =\u003c\u003cHJSON\n{\n  one: 1\n  two: 2\n  three: 4 # oops\n}\nHJSON\n\nHjson.parse(hjson) #=\u003e {\"one\"=\u003e1, \"two\"=\u003e2, \"three\"=\u003e4}\n```\n\n### Quoteless\n\nHjson makes quotes for strings optional as well.\n\n```ruby\nrequire 'hjson'\n\nhjson =\u003c\u003cHJSON\n{\n  text: look ma, no quotes!\n\n  # To make your life easy, put the next\n  # value or comment on a new line.\n  # It's also easier to read!\n}\nHJSON\n\nHjson.parse(hjson) #=\u003e {\"text\"=\u003e\"look ma, no quotes!\"}\n```\n\n### Escapes\n\nYou don't need to escape in unquoted strings.\n\n```ruby\nrequire 'hjson'\n\nhjson = \u003c\u003cHJSON\n{\n  # write a regex without escaping the escape\n  regex: ^\\d*\\.{0,1}\\d+$\n\n  # quotes in the content need no escapes\n  inject: \u003cdiv class=\"important\"\u003e\u003c/div\u003e\n\n  # inside quotes, escapes work\n  # just like in JSON\n  escape: \"\\\\\\\\ \\n \\t\\\\\"\"\n}\nHJSON\n\nHjson.parse(hjson)\n#=\u003e {\"regex\"=\u003e\"^d*.{0,1}d+$\",\n \"inject\"=\u003e\"\u003cdiv class=\\\"important\\\"\u003e\u003c/div\u003e\",\n \"escape\"=\u003e\"\\\\ \\n \\t\\\"\"}\n```\n\n### Multiline\n\nHjson allows you to use `'''` for writing multiline strings.\n\n```ruby\nrequire 'hjson'\n\nhjson =\u003c\u003cHJSON\n{\n  haiku:\n    '''\n    JSON I love you.\n    But strangled is my data.\n    This, so much better.\n    '''\n}\nHJSON\n\nHjson.parse(hjson) #=\u003e {\"haiku\"=\u003e\"JSON I love you.\\nBut strangled is my data.\\nThis, so much better.\"}\n```\n\n### Braces\n\nYou can omit the braces for the root object.\n\n```ruby\nrequire 'hjson'\n\nhjson =\u003c\u003cHJSON\n// this is a valid config file\njoke: My backslash escaped!\nHJSON\n\nHjson.parse(hjson) #=\u003e {\"joke\"=\u003e\"My backslash escaped!\"}\n```\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/namusyaka/hjson. 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\nThe gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhjson%2Fhjson-rb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhjson%2Fhjson-rb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhjson%2Fhjson-rb/lists"}