Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/kantord/emuto

manipulate JSON files
https://github.com/kantord/emuto

api awk cli data-mining data-structures frontend javascript jq json node processing-language programming-language query-language script sed

Last synced: about 1 month ago
JSON representation

manipulate JSON files

Awesome Lists containing this project

README

        




Website
Tutorial
Live demo
CLI version
Compile-to-JS version

---

Emuto is a small language for manipulating and restructuring JSON and other data files. [Emuto is inspired by jq and GraphQL](https://kantord.github.io/emuto/docs/comparison_with_other_languages)



![build](https://img.shields.io/travis/kantord/emuto/master.svg) ![Codecov](https://img.shields.io/codecov/c/github/kantord/emuto/master.svg) ![David](https://img.shields.io/david/kantord/emuto.svg) ![NPM](https://img.shields.io/npm/l/emuto.svg) ![GitHub release](https://img.shields.io/github/release/kantord/emuto.svg) [![Twitter URL](https://img.shields.io/twitter/url/https/https://github.com/kantord/emuto.svg?style=social)](https://twitter.com/intent/tweet?text=transform%20%26%20query%20jSON%2C%20CSV%2C%20etc.%20easily%20using%20emuto%20https%3A%2F%2Fgithub.com%2Fkantord%2Femuto)

## Features

- Transform and query data structures
- Integrate with unix commands in the command line
- Conversions between different file formats
- Supported input formats: JSON, text, csv, tsv, dsv
- Supported output formats: JSON, text
- Available as a Webpack loader

## Getting started

### Emuto as a CLI tool

```
npm install -g emuto emuto-cli
```

[Read more in the tutorial](https://kantord.github.io/emuto/docs/tutorial)

[For Arch Linux users, also available as an AUR package](https://aur.archlinux.org/packages/emuto/)

### Webpack loader for emuto

```
yarn add --dev emuto emuto-loader
```

[Read more in the Webpack guide](https://kantord.github.io/emuto/docs/setup-webpack)

## What is emuto good for? Examples

### Number of items in JSON file

```bash
curl my_file.json | emuto 'length'
```

### Your karma on HackerNews

```bash
curl https://hacker-news.firebaseio.com/v0/user/kantord.json -s | emuto '$.karma'
```

### Convert another command's output to JSON

```bash
ls | emuto -i=raw '$[0:-1]'
```

### See number of NPM dependencies

```bash
cat package.json | emuto -c '$.dependencies | keys | length'
```

### List available scripts in package.json

```bash
cat package.json | emuto -c '$.scripts | keys | join " · "'
```

### Get only the relevant data from a huge JSON file

```bash
curl https://api.github.com/repos/stedolan/jq/commits |\
emuto -c 'map ($ => $ { commit { message } committer { login } } )'
```

### Automate the restructuring of data by creating scripts with emuto

restructure.emu

```text
#! emuto -s

$
| map ($ => $ { commit { message } committer { login } } )
| map ($ => {
"committer": $.committer.login,
"message": $.commit.message,
})
```

Calling your script

```bash
curl https://api.github.com/repos/stedolan/jq/commits | ./restructure.emu
```

## [Contributing Guide](CONTRIBUTING.md)

Read our [contributing guide](CONTRIBUTING.md) to learn about our development process, how to create bugfixes and improvements, and how to build and test your changes to emuto.