• Stars
    star
    451
  • Rank 96,923 (Top 2 %)
  • Language
    Java
  • License
    MIT License
  • Created over 2 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

utt is the universal text transformer

utt

utt is the universal text transformer. utt is intended for converting between textual data representations. For example, utt can be used to convert from JSON to YAML:

$ echo "[1, 2, 3]" | utt -i json -o yaml
---
- 1
- 2
- 3

$ 

Formats may be supported for input-only or output-only. You can see all supported formats by running utt with no arguments.

At the time of writing, supported formats are:

  • JSON
  • XML
  • CSV
  • YAML
  • Java Properties
  • TOML
  • Base 64
  • Plain Text
  • ROT13
  • PyON (Python Object Notation)

Note: "universal" is a big claim, and I understand that utt isn't truly universal. However, it is an active goal to work on supporting more and more formats and transformations to make utt as close to truly universal as possible.

Getting it

A UNIX-compatible binary is automatically released here: https://github.com/queer/utt/releases. This binary is just:

$ echo "#!/usr/bin/env -S java -jar" > utt && cat utt-*.jar >> utt && chmod +x utt

On Windows, run mvn clean package to create a JAR file in target/.

Why is it so big???

Unfortunately, supporting everything under the sun requires dragging in a pretty ridiculous set of libraries. For example, to support Python dict notation, utt drags in an entire Python implementation via jython-standalone.

What and why

utt (case-sensitive) is a tool for converting between textual data formats. utt was originally written for a project that involved a lot of annoying conversions, to the point where one-off scripts wouldn't be enough.

utt makes some tradeoffs in the name of functionality. For example, utt does not process data in a streaming manner, but rather loads the entire dataset into memory before processing. In exchange, utt is more flexible in what it accepts as input and output formats. For example, utt can only output to CSV by iterating over the input data to determine the output schema. Similarly, utt's mapping functionality relies on the GraalVM Polyglot API, which has a high (~500ms) startup time.

While pandoc focuses more on converting between human formats like markdown and HTML, utt is more focused on converting between data formats understood by computers.

Examples

Convert from JSON to YAML

$ echo '{"key": [1, 2, 3]}' | utt -i json -o yaml
---
key:
- 1
- 2
- 3

$

Extract keys from a JSON object

$ echo '[{"key": 1}, {"key": 2}, {"key": 3}]' | utt -i json -o json -M '_.key'
[1.0,2.0,3.0]
$

Flatten a list

$ echo '[[1], [2], [3]]' | utt -i json -o json -F
[1.0,2.0,3.0]
$

Encode text with base64

$ echo "this is a test" | utt -i plain -o base64
dGhpcyBpcyBhIHRlc3Q=
$

Extract inner values and flatten

$ echo '{"key": [1, [2], [[3]]]}' | utt -i json -o json -M '_.key' -F
[1.0,2.0,3.0]
$ 

Extract a JSON array from an XML object

$ echo "<a><b>c</b><b>c</b><b>c</b><b>c</b></a>" | utt -i xml -o json -M '$.b'
["c","c","c","c"]
$

Apply a map function to the values of a list

$ echo "[1,2,3]" | utt -i json -o yaml -M "_ * 2"
---
- 2.0
- 4.0
- 6.0

$

More Repositories

1

boxxy

boxxy puts bad Linux applications in a box with only their files.
Rust
1,236
star
2

outage.bingo

https://outage.bingo
JavaScript
114
star
3

GFYPL

Go Fuck Yourself Private Licence
87
star
4

singyeong

신경 - Cloud-native messaging/pubsub with powerful routing
Elixir
78
star
5

atsi

instant rootless Alpine shells
Rust
60
star
6

makeup

Stylish CLIs/TUIs for Rust!
Rust
51
star
7

mahou

魔法 - Mahō is a highly-opinionated yet quite magical research project into microservice-oriented application infrastructure.
Elixir
47
star
8

peckish

peckish (case-sensitive) is a CLI tool/Rust library for (re)packaging Linux software artifacts.
Rust
45
star
9

qit

Overly opinionated git tooling
Rust
28
star
10

squish

An experimental, rootless, Alpine-based container runtime
Rust
22
star
11

crush

A time-traveling distributed key-value store
Elixir
20
star
12

land

Convert Docker images to Firecracker VM images!
Shell
20
star
13

whynottrack.com

HTML
18
star
14

hyperblock

[DEPRECATED] A theoretically-infinitely-scalable Skyblock plugin.
Java
17
star
15

that-goes-there

put things over there from over here
Rust
16
star
16

catnip-utilities

A collection of utility extensions to make using catnip easier
Java
13
star
17

emit

Powerful metadata-backed pubsub for Elixir.
Elixir
13
star
18

lethe

A vaguely-friendly query DSL for Mnesia
Elixir
12
star
19

floppy-disk

Async filesystem facade for Rust!
Rust
12
star
20

nyoom

zoomin' thru ur files
Rust
11
star
21

hl

A stupid wrapper around bat(1) to highlight code
Rust
8
star
22

carcinogenic

A collection of evil terrible no-good very-bad JVM hacks. DO NOT USE THIS.
Java
8
star
23

flail

Rust
7
star
24

box

A magical Minecraft box
Scala
7
star
25

p

Shell prompt
Rust
7
star
26

autumn

Experimental Netty-based Java 16 application/web framework
Java
7
star
27

adblocker

The marginally better ad-blocking plugin
Java
7
star
28

soulfire

The injection-only modding API for Minecraft
Java
7
star
29

jpeg.ink

Images with gradients
HTML
6
star
30

kyoyu

共有 (Kyōyū) is a screenshot + upload tool for Linux (theoretically cross-platform)
Rust
6
star
31

eyes

👀
JavaScript
6
star
32

madeline

*slaps #tatoboard* this bad boy can hold so many shittatoes in it
Java
5
star
33

cardboard

Java
5
star
34

smoosh

automagic async recompression!
Rust
5
star
35

peek

Peek at typespecs on your modules and get them in a human-friendly form.
Elixir
4
star
36

patbot

Java
4
star
37

wand

wand - wave your wand and deploy your code. 魔法's cli interface.
Elixir
4
star
38

automatic-minecraft-deobfuscator

Tool for automatically deobfuscating some classes in Minecraft
Java
4
star
39

amyism.pro

It goes on Netlify... or whatever.
HTML
4
star
40

async-postgres-jsonb-orm

A simple, a/sync JSONB ORM for Postgres, written in Java.
Java
4
star
41

redpear

Tess is a cutie uwu
Java
4
star
42

curlpipesh.me

Shell
3
star
43

pig

pig - the Pretty Insane Group scheduler. 魔法's container scheduler.
Elixir
3
star
44

text-processing-tools

A meta-repo for all my text-processing tools.
3
star
45

libmahou

libmahou - 魔法's shared-code library. Message definitions and more.
Elixir
3
star
46

pipe2

A reimplementation of Pipe, meant to be structured better.
Java
3
star
47

recipe-for-magic

A maybe-new kind of recipe browser for Fabric!
Java
3
star
48

flop

floppy-disk facade for common archive formats!
Rust
2
star
49

echo

No-nonsense JSON echo server
Elixir
2
star
50

singyeong_plugin

신경 plugin API
Elixir
2
star
51

cve.bingo

HTML
2
star
52

decompressor

c the automagic de(c)ompressor
Rust
2
star
53

catnip-rxjava2

RxJava 2 Observable support for catnip!
Java
2
star
54

agma

악마 - 魔法's host daemon. host stats, container mangling, and more.
Elixir
2
star
55

discord-codegen

Python
2
star
56

lace

Redis-backed Erlang node clustering and autodiscovery
Elixir
2
star
57

cache

Elixir
2
star
58

app-image-converter

A little CLI that converts Dockerfiles into more-interesting things
Go
2
star
59

amybot-gateway

Java
1
star
60

git-release-message

Generate a release message based on the commits between the two most-recent tags
Rust
1
star
61

baka

Stupid simple future executor
Rust
1
star
62

amybot-shards

Java
1
star
63

sajeon

Autodoc viewer for 魔法
Elixir
1
star
64

actions

JavaScript
1
star
65

sigil

sigil application gateway / controller.
Elixir
1
star
66

uefi-os

A half-assed attempt at making a UEFI-bootable OS
C
1
star
67

violet

A simple, pure-Elixir etcd client.
Elixir
1
star
68

libguestfs-rs

Rust
1
star
69

eden-ex

A distributed etcd-backed Elixir node registry.
Elixir
1
star
70

amynia-bot

amynia!bot plays osu!mania through OpenCV and guesswork.
Python
1
star
71

yangmal

양말 means "socks." Typesafe commands for catnip
Java
1
star
72

singyeong-client-elixir

Elixir client for 신경
Elixir
1
star
73

fumetsu

Elixir
1
star
74

disk-drive

Multi-disk utilities for floppy-disk!
Rust
1
star
75

amyqp

Elixir
1
star
76

amelia

Distributed timed / data-based locking for Elixir.
Elixir
1
star