Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/alexflint/jsoncat

Streaming json pretty-printer
https://github.com/alexflint/jsoncat

Last synced: 22 days ago
JSON representation

Streaming json pretty-printer

Awesome Lists containing this project

README

        

A pretty-printer for files containing more than one json object.

## Overview

Consider the following file:

```json
{"abc": "def"}{"ham": "spam", "numbers": [1, 2, 3]}{"foo": "bar"}
```

The contents of this file do not constitute a valid json object when taken as a whole. Instead, the file contains a _stream_ of json objects. Jsoncat will pretty-print this file as so:

```json
{
"abc": "def"
}
{
"ham": "spam",
"numbers": [
1,
2,
3
]
}
{
"foo": "bar"
}
```

## Installation

```bash
pip install jsoncatcmd
```

## Usage

Read from a file:

```bash
jsoncat myfile.json
```

Read from stdin:

```bash
cat myfile.json | jsoncat
```

Read a gzipped json stream:

```bash
cat myfile.json.gz | zcat | jsoncat
```