All Projects → Blacksmoke16 → Oq

Blacksmoke16 / Oq

Licence: mit
A performant, and portable jq wrapper to facilitate the consumption and output of formats other than JSON; using jq filters to transform the data.

Programming Languages

crystal
512 projects

Projects that are alternatives of or similar to Oq

Dasel
Query, update and convert data structures from the command line. Comparable to jq/yq but supports JSON, TOML, YAML, XML and CSV with zero runtime dependencies.
Stars: ✭ 759 (+475%)
Mutual labels:  cli, json, xml, yaml, devops-tools, portable
Yq
Command-line YAML, XML, TOML processor - jq wrapper for YAML/XML/TOML documents
Stars: ✭ 1,688 (+1178.79%)
Mutual labels:  cli, json, xml, yaml, jq
Structured Text Tools
A list of command line tools for manipulating structured text data
Stars: ✭ 6,180 (+4581.82%)
Mutual labels:  cli, json, xml, yaml
Yq
yq is a portable command-line YAML processor
Stars: ✭ 4,726 (+3480.3%)
Mutual labels:  cli, yaml, devops-tools, portable
Choetl
ETL Framework for .NET / c# (Parser / Writer for CSV, Flat, Xml, JSON, Key-Value, Parquet, Yaml, Avro formatted files)
Stars: ✭ 372 (+181.82%)
Mutual labels:  json, xml, yaml
Jql
A JSON Query Language CLI tool
Stars: ✭ 368 (+178.79%)
Mutual labels:  cli, json, devops-tools
Remarshal
Convert between CBOR, JSON, MessagePack, TOML, and YAML
Stars: ✭ 421 (+218.94%)
Mutual labels:  cli, json, yaml
Tmuxp
💻 tmux session manager. built on libtmux
Stars: ✭ 3,269 (+2376.52%)
Mutual labels:  cli, json, yaml
Countries
World countries in JSON, CSV, XML and Yaml. Any help is welcome!
Stars: ✭ 5,379 (+3975%)
Mutual labels:  json, xml, yaml
Fast Xml Parser
Validate XML, Parse XML to JS/JSON and vise versa, or parse XML to Nimn rapidly without C/C++ based libraries and no callback
Stars: ✭ 1,021 (+673.48%)
Mutual labels:  cli, json, xml
Countries States Cities Database
🌍 World countries, states, regions, provinces, cities, towns in JSON, SQL, XML, PLIST, YAML, and CSV. All Countries, States, Cities with ISO2, ISO3, Country Code, Phone Code, Capital, Native Language, Timezones, Latitude, Longitude, Region, Subregion, Flag Emoji, and Currency. #countries #states #cities
Stars: ✭ 1,130 (+756.06%)
Mutual labels:  json, xml, yaml
Feedr
Use feedr to fetch the data from a remote url, respect its caching, and parse its data. Despite its name, it's not just for feed data but also for all data that you can feed into it (including binary data).
Stars: ✭ 56 (-57.58%)
Mutual labels:  json, xml, yaml
Jokeapi
A REST API that serves uniformly and well formatted jokes in JSON, XML, YAML or plain text format that also offers a great variety of filtering methods
Stars: ✭ 71 (-46.21%)
Mutual labels:  json, xml, yaml
Xidel
Command line tool to download and extract data from HTML/XML pages or JSON-APIs, using CSS, XPath 3.0, XQuery 3.0, JSONiq or pattern matching. It can also create new or transformed XML/HTML/JSON documents.
Stars: ✭ 335 (+153.79%)
Mutual labels:  cli, json, xml
Visidata
A terminal spreadsheet multitool for discovering and arranging data
Stars: ✭ 4,606 (+3389.39%)
Mutual labels:  cli, json, devops-tools
Jinja2 Cli
CLI for Jinja2
Stars: ✭ 302 (+128.79%)
Mutual labels:  cli, xml, yaml
Cli
A simple, fast, and fun package for building command line apps in Go
Stars: ✭ 16,995 (+12775%)
Mutual labels:  cli, json, yaml
Korio
Korio: Kotlin cORoutines I/O : Virtual File System + Async/Sync Streams + Async TCP Client/Server + WebSockets for Multiplatform Kotlin 1.3
Stars: ✭ 282 (+113.64%)
Mutual labels:  json, xml, yaml
Ansible Config encoder filters
Ansible role used to deliver the Config Encoder Filters.
Stars: ✭ 48 (-63.64%)
Mutual labels:  json, xml, yaml
Metayaml
A powerful schema validator!
Stars: ✭ 92 (-30.3%)
Mutual labels:  json, xml, yaml

oq

Built with Crystal CI Latest release oq

A performant, portable jq wrapper thats facilitates the consumption and output of formats other than JSON; using jq filters to transform the data.

  • Compiles to a single binary for easy portability.
  • Performant, similar performance with JSON data compared to jq. Slightly longer execution time when going to/from a non-JSON format.
  • Supports various other input/output formats, such as XML and YAML.
  • Can be used as a dependency within other Crystal projects.

Installation

Linux via snap

For more on installing & using snap with your Linux distribution, see the official documentation.

snap install oq

MacOS

brew install oq

From Source

If building from source, jq will need to be installed separately. Installation instructions can be found in the official documentation.

Requires Crystal to be installed, see the installation documentation.

git clone https://github.com/Blacksmoke16/oq.git
cd oq/
shards build --production --release

The 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.

Docker

oq can easily be included into a Docker image by fetching the static binary from Github for the version of oq that you want.

# Set an arg to store the oq version that should be installed.
ARG OQ_VERSION=1.2.0

# 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.
RUN wget https://github.com/Blacksmoke16/oq/releases/download/v${OQ_VERSION}/oq-v${OQ_VERSION}-linux-x86_64 -O /usr/local/bin/oq && chmod +x /usr/local/bin/oq

# Or using curl (needs to follow Github's redirect):
RUN curl -L -o /usr/local/bin/oq https://github.com/Blacksmoke16/oq/releases/download/v${OQ_VERSION}/oq-v${OQ_VERSION}-linux-x86_64 && chmod +x /usr/local/bin/oq

# Also be sure to install jq if it is not already!

Existing Crystal Project

Add the following to your shard.yml and run shards install.

dependencies:
  oq:
    github: blacksmoke16/oq
    version: ~> 1.2.0

Usage

CLI

Use the oq binary, with a few optional custom arguments, see oq --help. All other arguments get passed to jq. See jq manual for details.

Library

Checkout the API Documentation for using oq within an existing Crystal project.

Examples

Consume JSON and output XML

$ echo '{"name": "Jim"}' | oq -o xml .
<?xml version="1.0" encoding="UTF-8"?>
<root>
  <name>Jim</name>
</root>

Consume YAML from a file and output XML

data.yaml

---
name: Jim
numbers:
  - 1
  - 2
  - 3
$ oq -i yaml -o xml . data.yaml 
<?xml version="1.0" encoding="UTF-8"?>
<root>
  <name>Jim</name>
  <numbers>1</numbers>
  <numbers>2</numbers>
  <numbers>3</numbers>
</root>

Use oq as a library, consuming some raw JSON input, convert it to YAML, and write the transformed data to a file.

require "oq"

# This could be any `IO`, e.g. an `HTTP` request body, etc.
input_io = IO::Memory.new %({"name":"Jim"})

# Create a processor, specifying that we want the output format to be `YAML`.
processor = OQ::Processor.new output_format: :yaml

File.open("./out.yml", "w") do |file|
  # Process the data using our custom input and output IOs.
  # The first argument represents the input arguments;
  # i.g. the filter and/or any other arguments that should be passed to `jq`.
  processor.process ["."], input: input_io, output: file
end

Contributing

  1. Fork it (https://github.com/Blacksmoke16/oq/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].