{"id":33916658,"url":"https://github.com/cacfd3a/ruby-xml-to-json","last_synced_at":"2025-12-12T07:26:46.569Z","repository":{"id":33767454,"uuid":"37423361","full_name":"cacfd3a/ruby-xml-to-json","owner":"cacfd3a","description":"Ruby gem to serialize Nokogiri XML documents into JSON","archived":false,"fork":false,"pushed_at":"2025-10-28T11:32:53.000Z","size":15,"stargazers_count":18,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-06T20:40:01.085Z","etag":null,"topics":["json","nokogiri","ruby","xml","xml-to-json"],"latest_commit_sha":null,"homepage":null,"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/cacfd3a.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2015-06-14T18:03:21.000Z","updated_at":"2025-10-28T11:32:58.000Z","dependencies_parsed_at":"2022-09-01T12:02:25.288Z","dependency_job_id":null,"html_url":"https://github.com/cacfd3a/ruby-xml-to-json","commit_stats":null,"previous_names":["cacfd3a/ruby-xml-to-json","digitalheir/ruby-xml-to-json"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/cacfd3a/ruby-xml-to-json","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cacfd3a%2Fruby-xml-to-json","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cacfd3a%2Fruby-xml-to-json/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cacfd3a%2Fruby-xml-to-json/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cacfd3a%2Fruby-xml-to-json/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cacfd3a","download_url":"https://codeload.github.com/cacfd3a/ruby-xml-to-json/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cacfd3a%2Fruby-xml-to-json/sbom","scorecard":{"id":342511,"data":{"date":"2025-08-11","repo":{"name":"github.com/digitalheir/ruby-xml-to-json","commit":"53d4529f8232ffcd3d2b5e427aa0fcb58b73f91d"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Code-Review","score":0,"reason":"Found 0/15 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE.txt:0","Info: FSF or OSI recognized license: MIT License: LICENSE.txt:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-18T06:13:22.531Z","repository_id":33767454,"created_at":"2025-08-18T06:13:22.531Z","updated_at":"2025-08-18T06:13:22.531Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27678871,"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-12-12T02:00:06.775Z","response_time":129,"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":["json","nokogiri","ruby","xml","xml-to-json"],"created_at":"2025-12-12T07:26:40.992Z","updated_at":"2025-12-12T07:26:46.563Z","avatar_url":"https://github.com/cacfd3a.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# XML to JSON\n[![Build Status](https://travis-ci.org/digitalheir/ruby-xml-to-json.svg?branch=master)](https://travis-ci.org/digitalheir/ruby-xml-to-json)\n[![Code Climate](https://codeclimate.com/github/digitalheir/ruby-xml-to-json/badges/gpa.svg)](https://codeclimate.com/github/digitalheir/ruby-xml-to-json)\n[![Test Coverage](https://codeclimate.com/github/digitalheir/ruby-xml-to-json/badges/coverage.svg)](https://codeclimate.com/github/digitalheir/ruby-xml-to-json/coverage)\n\nThis Ruby gem adds a `to_hash` and `to_json` method to Nokogiri XML nodes, allowing us to serialize arbitrary XML nodes to JSON.\n\nThis gem also picks up attributes, comments, processing instructions and doctype declarations. The result is wordy, but complete.\n\nAs an added bonus, line numbers are included where possible.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'xml-to-json'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install xml-to-json\n\n## Usage\n\n```ruby\nrequire 'xml/to/json'\n\nxml_string = STR_XML = \u003c\u003c-EOS\n                       \u003c!DOCTYPE dtd-name [\n                          \u003c!ENTITY entity_1 \"Has been ëxpÄnded\"\u003e\n                          \u003c!ENTITY entity_system SYSTEM \"mt_cook1.jpg\"\u003e\n                          \u003c!ENTITY name_public PUBLIC \"entity_public_id\" \"URI\"\u003e\n                          \u003c!NOTATION notation-system SYSTEM \"notation-id-system\"\u003e\n                          \u003c!NOTATION NoTaTiOn-PuBLiC PUBLIC \"notation-id-public\"\u003e\n                          \u003c!ELEMENT div1 (head,\n                       (p | list | note)*,\n                       div2*)\u003e\n                          \u003c!ELEMENT photo (hello)\u003e\n                          \u003c!ATTLIST photo some-attribute CDATA #REQUIRED\u003e\n                          \u003c!ATTLIST\n                            photo photo_att ENTITY #IMPLIED\n                            photo NOTATION (notation-system | NoTaTiOn-PuBLiC | notation-system) #IMPLIED\u003e\n                       ]\u003e\n\n                       \u003cmyRoot xml:id=\"root\" xml:lang=\"en\"\u003e\n                             some text\n                             \u003c!--\n                             In comments we can use ]]\u003e\n                             \u003c\n                             \u0026,\n                       ',\n                       and \",\n                       but %MyParamEntity; will not be expanded--\u003e\n                             \u003c![CDATA[\n                             Character Data block \u003c!-- \u003c,\n                       \u0026 ' \" --\u003e  *and* %MyParamEntity;\n                             ]]\u003e\n                             \u003c?linebreak?\u003e\n                             \u003cdeeper xmlns=\"lol://some-namespace\" how-deep=\"very-deep\"\u003e☠☠☠randomtext☠☠☠\n                             \u003ceven\n                               lol:my-attr=\"just an attribute\"\n                               xmlns:lol=\\'lol://my.name.space/\\' deeper=\"true\"\u003e\u0026amp;\u003c/even\u003e\u003c/deeper\u003e\n                       \u003c/myRoot\u003e\nEOS\n\nxml = Nokogiri::XML STR_XML\nputs JSON.pretty_generate(xml.root) # Use xml for information about the document, like DTD and stuff\n```\n\nproduces\n\n```json\n{\n  \"type\": \"element\",\n  \"name\": \"myRoot\",\n  \"attributes\": [\n    {\n      \"type\": \"attribute\",\n      \"name\": \"id\",\n      \"content\": \"root\",\n      \"line\": 17,\n      \"namespace\": {\n        \"href\": \"http://www.w3.org/XML/1998/namespace\",\n        \"prefix\": \"xml\"\n      }\n    },\n    {\n      \"type\": \"attribute\",\n      \"name\": \"lang\",\n      \"content\": \"en\",\n      \"line\": 17,\n      \"namespace\": {\n        \"href\": \"http://www.w3.org/XML/1998/namespace\",\n        \"prefix\": \"xml\"\n      }\n    }\n  ],\n  \"line\": 17,\n  \"children\": [\n    {\n      \"type\": \"text\",\n      \"content\": \"\\n                             some text\\n                             \",\n      \"line\": 19\n    },\n    {\n      \"type\": \"comment\",\n      \"content\": \"\\n                             In comments we can use ]]\u003e\\n                             \u003c\\n                             \u0026,\\n                       ',\\n                       and \\\",\\n                       but %MyParamEntity; will not be expanded\",\n      \"line\": 25\n    },\n    {\n      \"type\": \"text\",\n      \"content\": \"\\n                             \",\n      \"line\": 26\n    },\n    {\n      \"type\": \"cdata\",\n      \"name\": \"#cdata-section\",\n      \"content\": \"\\n                             Character Data block \u003c!-- \u003c,\\n                       \u0026 ' \\\" --\u003e  *and* %MyParamEntity;\\n                             \",\n      \"line\": 26\n    },\n    {\n      \"type\": \"text\",\n      \"content\": \"\\n                             \",\n      \"line\": 30\n    },\n    {\n      \"type\": \"pi\",\n      \"name\": \"linebreak\",\n      \"line\": 30\n    },\n    {\n      \"type\": \"text\",\n      \"content\": \"\\n                             \",\n      \"line\": 31\n    },\n    {\n      \"type\": \"element\",\n      \"name\": \"deeper\",\n      \"attributes\": [\n        {\n          \"type\": \"attribute\",\n          \"name\": \"how-deep\",\n          \"content\": \"very-deep\",\n          \"line\": 31\n        }\n      ],\n      \"line\": 31,\n      \"namespace\": {\n        \"href\": \"lol://some-namespace\"\n      },\n      \"children\": [\n        {\n          \"type\": \"text\",\n          \"content\": \"☠☠☠randomtext☠☠☠\\n                             \",\n          \"line\": 32\n        },\n        {\n          \"type\": \"element\",\n          \"name\": \"even\",\n          \"attributes\": [\n            {\n              \"type\": \"attribute\",\n              \"name\": \"my-attr\",\n              \"content\": \"just an attribute\",\n              \"line\": 34,\n              \"namespace\": {\n                \"href\": \"lol://my.name.space/\",\n                \"prefix\": \"lol\"\n              }\n            },\n            {\n              \"type\": \"attribute\",\n              \"name\": \"deeper\",\n              \"content\": \"true\",\n              \"line\": 34\n            }\n          ],\n          \"line\": 34,\n          \"namespace\": {\n            \"href\": \"lol://some-namespace\"\n          },\n          \"children\": [\n            {\n              \"type\": \"text\",\n              \"content\": \"\u0026\",\n              \"line\": 34\n            }\n          ]\n        }\n      ]\n    },\n    {\n      \"type\": \"text\",\n      \"content\": \"\\n                       \",\n      \"line\": 35\n    }\n  ]\n}\n```\n\n## Development\n\nAfter 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\nTo 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\nBug reports and pull requests are welcome on GitHub at https://github.com/digitalheir/ruby-xml-to-json. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](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","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcacfd3a%2Fruby-xml-to-json","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcacfd3a%2Fruby-xml-to-json","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcacfd3a%2Fruby-xml-to-json/lists"}