CLI tool to convert HOCON into valid JSON or YAML written in Rust.

Overview

{hocon:vert}

CLI Tool to convert HOCON into valid JSON or YAML.

Under normal circumstances this is mostly not needed because hocon configs are parsed within the application – case closed. But for example in conjunction with Kubernetes where .conf files can reside in ConfigMaps there was that need to extract information on command line from time to time. And what would be more comfortable than to use jq for this.

Usage

hoconvert [input] [--yaml]

Either provide the hocon as first argument:

hoconvert "foo = bar"

or provide it from stdin,

echo "foo = bar" | hoconvert

which leads to the following output:

{
  "foo": "bar"
}

Here is an example of a real-life Kubernetes problem as stated above:

kubectl get cm <any ConfigMap> -o jsonpath='{.data.myHocon}' | jq -r | hoconvert | jq '.doWhatEverYouWant'

Installation

Install with homebrew

In case you use brew you can install hoconvert as follows:

brew tap maoertel/tap
brew install hoconvert

You can install from brew for the following architectures: macOS/amd64, macOS/arm64 or linux/amd64.

Download the binary

You can download a binary of the latest release currently for macOS/amd64, macOS/arm64 and linux/amd64.

Install with cargo

In case you have cargo installed this is the easiest way to install hoconvert from crates.io in match to your underlying architecture:

cargo install hoconvert

Build it yourself

Check this repo out, change into the project directory and run:

cargo build --release
You might also like...
JSON parser which picks up values directly without performing tokenization in Rust
JSON parser which picks up values directly without performing tokenization in Rust

Pikkr JSON parser which picks up values directly without performing tokenization in Rust Abstract Pikkr is a JSON parser which picks up values directl

Strongly typed JSON library for Rust

Serde JSON   Serde is a framework for serializing and deserializing Rust data structures efficiently and generically. [dependencies] serde_json = "1.0

JSON implementation in Rust
JSON implementation in Rust

json-rust Parse and serialize JSON with ease. Changelog - Complete Documentation - Cargo - Repository Why? JSON is a very loose format where anything

Rust port of gjson,get JSON value by dotpath syntax

A-JSON Read JSON values quickly - Rust JSON Parser change name to AJSON, see issue Inspiration comes from gjson in golang Installation Add it to your

A easy and declarative way to test JSON input in Rust.

assert_json A easy and declarative way to test JSON input in Rust. assert_json is a Rust macro heavily inspired by serde json macro. Instead of creati

A small rust database that uses json in memory.

Tiny Query Database (TQDB) TQDB is a small library for creating a query-able database that is encoded with json. The library is well tested (~96.30% c

rurl is like curl but with a json configuration file per request

rurl rurl is a curl-like cli tool made in rust, the difference is that it takes its params from a json file so you can have all different requests sav

Easily create dynamic css using json notation

jss! This crate provides an easy way to write dynamic css using json notation. This gives you more convenient than you think. Considering using a dyna

A node package based on jsonschema-rs for performing JSON schema validation

A node package based on jsonschema-rs for performing JSON schema validation.

Comments
  • Optimise error handling

    Optimise error handling

    This PR implements an own error type as wrapper for other error families and changes the flow how errors will be propagated.

    Furthermore it updates dependencies and established [dev-dependencies] to slim down the release build binary.

    opened by maoertel 0
Releases(v0.1.3)
Owner
Mathias Oertel
Rust & Scala
Mathias Oertel
An Emmet-like language that produces JSON, TOML, or YAML

.august:true August is an Emmet-like language that produces JSON, TOML, or YAML from a single-line concise selector-like syntax. If you aren't familia

Yoav Lavi 39 Aug 17, 2023
Get JSON values quickly - JSON parser for Rust

get json values quickly GJSON is a Rust crate that provides a fast and simple way to get values from a json document. It has features such as one line

Josh Baker 160 Dec 29, 2022
A JSON Query Language CLI tool built with Rust 🦀

JQL A JSON Query Language CLI tool built with Rust ?? ?? Core philosophy ?? Stay lightweight ?? Keep its features as simple as possible ?? Avoid redun

Davy Duperron 872 Jan 1, 2023
Smol cli tool that converts Happy Scribe JSON to VTT understood by Podlove.

happyscribe2podlove Super smol cli tool that converts JSON from Happy Scribe to a sane VTT format that works with the Podlove Publisher. Get started E

Arne Bahlo 2 Feb 7, 2022
Typify - Compile JSON Schema documents into Rust types.

Typify Compile JSON Schema documents into Rust types. This can be used ... via the macro import_types!("types.json") to generate Rust types directly i

Oxide Computer Company 73 Dec 27, 2022
Decode Metaplex mint account metadata into a JSON file.

Simple Metaplex Decoder (WIP) Install From Source Install Rust. curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh Clone the source: git c

Samuel Vanderwaal 8 Aug 25, 2022
Serialize JSON into a canonical format.

json-canon Serialize JSON into a canonical format. Safe for generating a consistent cryptographic hash or signature across platforms. Follows RFC8785:

Mikey 14 May 30, 2023
A tool for outputs semantic difference of json

jsondiff A tool for outputs semantic difference of json. "semantic" means: sort object key before comparison sort array before comparison (optional, b

niboshi 3 Sep 22, 2021
A fast and simple command-line tool for common operations over JSON-lines files

rjp: Rapid JSON-lines processor A fast and simple command-line tool for common operations over JSON-lines files, such as: converting to and from text

Ales Tamchyna 3 Jul 8, 2022
command line tool to navigate JSON files with basic SQL-like queries

navi-json command line tool to navigate JSON files with basic SQL-like queries. The name plays with the assonance with the word 'navigator', at least

Giulio Toldo 2 Oct 2, 2022