{"id":15713588,"url":"https://github.com/blacksmoke16/oq","last_synced_at":"2025-05-16T19:07:34.833Z","repository":{"id":36353354,"uuid":"194356575","full_name":"Blacksmoke16/oq","owner":"Blacksmoke16","description":"A performant, and portable jq wrapper to facilitate the consumption and output of formats other than JSON; using jq filters to transform the data.","archived":false,"fork":false,"pushed_at":"2025-01-12T21:51:02.000Z","size":179,"stargazers_count":195,"open_issues_count":12,"forks_count":15,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-05-16T19:07:12.762Z","etag":null,"topics":["cli","crystal","devops-tools","jq","json","portable","xml","yaml"],"latest_commit_sha":null,"homepage":"https://blacksmoke16.github.io/oq/","language":"Crystal","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/Blacksmoke16.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"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}},"created_at":"2019-06-29T02:41:53.000Z","updated_at":"2025-05-12T05:18:42.000Z","dependencies_parsed_at":"2024-01-20T22:29:12.175Z","dependency_job_id":"3fe012ce-a7b1-4a79-af03-e56cdb40dde6","html_url":"https://github.com/Blacksmoke16/oq","commit_stats":{"total_commits":92,"total_committers":9,"mean_commits":"10.222222222222221","dds":0.5326086956521738,"last_synced_commit":"a81bcc8653b94507314289b7d48dd3d3e9dbc155"},"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Blacksmoke16%2Foq","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Blacksmoke16%2Foq/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Blacksmoke16%2Foq/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Blacksmoke16%2Foq/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Blacksmoke16","download_url":"https://codeload.github.com/Blacksmoke16/oq/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254592395,"owners_count":22097013,"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":["cli","crystal","devops-tools","jq","json","portable","xml","yaml"],"created_at":"2024-10-03T21:32:17.847Z","updated_at":"2025-05-16T19:07:34.806Z","avatar_url":"https://github.com/Blacksmoke16.png","language":"Crystal","funding_links":[],"categories":[],"sub_categories":[],"readme":"# oq\n\n[![Built with Crystal](https://img.shields.io/badge/built%20with-crystal-000000.svg?logo=crystal)](https://crystal-lang.org/)\n[![CI](https://github.com/blacksmoke16/oq/workflows/CI/badge.svg)](https://github.com/blacksmoke16/oq/actions?query=workflow%3ACI)\n[![Latest release](https://img.shields.io/github/release/blacksmoke16/oq.svg?color=teal\u0026logo=github)](https://github.com/blacksmoke16/oq/releases)\n[![oq](https://snapcraft.io/oq/badge.svg)](https://snapcraft.io/oq)\n[![oq](https://img.shields.io/aur/version/oq?label=oq\u0026logo=arch-linux)](https://aur.archlinux.org/packages/oq/)\n[![oq-bin](https://img.shields.io/aur/version/oq-bin?label=oq-bin\u0026logo=arch-linux)](https://aur.archlinux.org/packages/oq-bin/)\n\nA performant, portable [jq](https://github.com/stedolan/jq/) wrapper that facilitates the consumption and output of formats other than JSON; using `jq` filters to transform the data.\n\n* Compiles to a single binary for easy portability.\n* Performant, similar performance with JSON data compared to `jq`.  Slightly longer execution time when going to/from a non-JSON format.\n* Supports various other input/output [formats](https://blacksmoke16.github.io/oq/OQ/Format.html), such as `XML` and `YAML`.\n* Can be used as a dependency within other Crystal projects.\n\n## Installation\n\n### Linux\n\nA statically linked binary for Linux `x86_64` as available on the [Releases](https://github.com/Blacksmoke16/oq/releases) tab.  Additionally it can also be installed via various package managers.\n\n#### Snapcraft\n\nFor more on installing \u0026 using `snap` with your Linux distribution, see the [official documentation](https://docs.snapcraft.io/installing-snapd).\n\n```sh\nsudo snap install oq\n```\n\n#### Arch Linux\n\nUsing [yay](https://github.com/Jguer/yay):\n\n```sh\nyay -S oq\n```\n\nA pre-compiled version is also available:\n\n```sh\nyay -S oq-bin\n```\n\n### macOS\n\n```sh\nbrew install oq\n```\n\n### From Source\n\nIf building from source, `jq` will need to be installed separately. Installation instructions can be found in the [official documentation](https://stedolan.github.io/jq/).\n\nRequires Crystal to be installed, see the [installation documentation](https://crystal-lang.org/install).\n\n```sh\ngit clone https://github.com/Blacksmoke16/oq.git\ncd oq/\nshards build --production --release\n```\n\nThe built binary will be available as `./bin/oq`.  This can be relocated elsewhere on your machine; be sure it is in your `PATH` to access it as `oq`.\n\n### Docker\n\n`oq` can easily be included into a Docker image by fetching the static binary from Github for the version of `oq` that you want.\n\n```dockerfile\n# Set an arg to store the oq version that should be installed.\nARG OQ_VERSION=1.3.5\n\n# Grab the binary from the latest Github release and make it executable; placing it within /usr/local/bin.  Can also put it elsewhere if you so desire.\nRUN wget https://github.com/Blacksmoke16/oq/releases/download/v${OQ_VERSION}/oq-v${OQ_VERSION}-linux-x86_64 -O /usr/local/bin/oq \u0026\u0026 chmod +x /usr/local/bin/oq\n\n# Or using curl (needs to follow Github's redirect):\nRUN curl -L -o /usr/local/bin/oq https://github.com/Blacksmoke16/oq/releases/download/v${OQ_VERSION}/oq-v${OQ_VERSION}-linux-x86_64 \u0026\u0026 chmod +x /usr/local/bin/oq\n\n# Also be sure to install jq if it is not already!\n```\n\n### Existing Crystal Project\n\nAdd the following to your `shard.yml` and run `shards install`.\n\n```yaml\ndependencies:\n  oq:\n    github: blacksmoke16/oq\n    version: ~\u003e 1.3.0\n```\n\n## Usage\n\n### CLI\n\nUse the `oq` binary, with a few optional custom arguments, see `oq --help`.  All other arguments get passed to `jq`. See [jq manual](https://stedolan.github.io/jq/manual/) for details.\n\n### Library\n\nCheckout the [API Documentation](https://blacksmoke16.github.io/oq/OQ/Processor.html) for using `oq` within an existing Crystal project.\n\n### Examples\n\nConsume JSON and output XML\n\n```sh\n$ echo '{\"name\": \"Jim\"}' | oq -o xml .\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n\u003croot\u003e\n  \u003cname\u003eJim\u003c/name\u003e\n\u003c/root\u003e\n```\n\nConsume YAML from a file and output XML\n\ndata.yaml\n\n```yaml\n---\nname: Jim\nnumbers:\n  - 1\n  - 2\n  - 3\n```\n\n```sh\n$ oq -i yaml -o xml . data.yaml\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n\u003croot\u003e\n  \u003cname\u003eJim\u003c/name\u003e\n  \u003cnumbers\u003e1\u003c/numbers\u003e\n  \u003cnumbers\u003e2\u003c/numbers\u003e\n  \u003cnumbers\u003e3\u003c/numbers\u003e\n\u003c/root\u003e\n```\n\nUse `oq` as a library, consuming some raw `JSON` input, convert it to `YAML`, and write the transformed data to a file.\n\n```crystal\nrequire \"oq\"\n\n# This could be any `IO`, e.g. an `HTTP` request body, etc.\ninput_io = IO::Memory.new %({\"name\":\"Jim\"})\n\n# Create a processor, specifying that we want the output format to be `YAML`.\nprocessor = OQ::Processor.new output_format: :yaml\n\nFile.open(\"./out.yml\", \"w\") do |file|\n  # Process the data using our custom input and output IOs.\n  # The first argument represents the input arguments;\n  # i.e. the filter and/or any other arguments that should be passed to `jq`.\n  processor.process [\".\"], input: input_io, output: file\nend\n```\n\n## Contributing\n\n1. Fork it (\u003chttps://github.com/Blacksmoke16/oq/fork\u003e)\n2. Create your 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. Create a new Pull Request\n\n## Contributors\n\n- [George Dietrich](https://github.com/Blacksmoke16) - creator, maintainer\n- [Michael Springer](https://github.com/sprngr) - contributor\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblacksmoke16%2Foq","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fblacksmoke16%2Foq","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblacksmoke16%2Foq/lists"}