https://github.com/queer/utt Skip to content Sign up * Product + Features + Mobile + Actions + Codespaces + Packages + Security + Code review + Issues + Integrations + GitHub Sponsors + Customer stories * Team * Enterprise * Explore + Explore GitHub + Learn and contribute + Topics + Collections + Trending + Learning Lab + Open source guides + Connect with others + The ReadME Project + Events + Community forum + GitHub Education + GitHub Stars program * Marketplace * Pricing + Plans + Compare plans + Contact Sales + Education [ ] * # In this repository All GitHub | Jump to | * No suggested jump to results * # In this repository All GitHub | Jump to | * # In this user All GitHub | Jump to | * # In this repository All GitHub | Jump to | Sign in Sign up {{ message }} queer / utt Public * Notifications * Fork 0 * Star 80 utt is the universal text transformer 80 stars 0 forks Star Notifications * Code * Issues 1 * Pull requests 0 * Actions * Projects 0 * Wiki * Security * Insights More * Code * Issues * Pull requests * Actions * Projects * Wiki * Security * Insights This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository. mistress Switch branches/tags [ ] Branches Tags Could not load branches Nothing to show {{ refName }} default View all branches Could not load tags Nothing to show {{ refName }} default View all tags 1 branch 1 tag Code Latest commit @queer queer [?][?] refactor: Make CsvTransformer use instanceof bindings ... 26c0e21 Mar 7, 2022 [?][?] refactor: Make CsvTransformer use instanceof bindings 26c0e21 Git stats * 37 commits Files Permalink Failed to load latest commit information. Type Name Latest commit message Commit time .github/workflows fix: Fix releases Mar 7, 2022 .idea feature: Support key extraction with --extract Mar 4, 2022 src [?][?] refactor: Make CsvTransformer use instanceof bindings Mar 7, 2022 .gitignore feature: Allow packaging executable Feb 28, 2022 README.md chore: Fix bash syntax in README Mar 7, 2022 build.sh style: :D Feb 28, 2022 install.sh feature: Support key extraction with --extract Mar 4, 2022 pom.xml feature: Add -M for mapping Mar 4, 2022 View code [ ] utt Getting it What and why Examples Convert from JSON to YAML Extract keys from a JSON object Flatten a list Encode text with base64 Extract inner values and flatten Extract a JSON array from an XML object Apply a map function to the values of a list README.md 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. [6874747073] 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/. 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. 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 "cccc" | 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 $ About utt is the universal text transformer Resources Readme Stars 80 stars Watchers 2 watching Forks 0 forks Releases 1 0.0.1 Latest Mar 7, 2022 Packages 0 No packages published Languages * Java 99.4% * Shell 0.6% * (c) 2022 GitHub, Inc. * Terms * Privacy * Security * Status * Docs * Contact GitHub * Pricing * API * Training * Blog * About You can't perform that action at this time. You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.