https://github.com/yord/pxi-json
🧚pxi-json is a JSON plugin for pxi (pixie), the small, fast, and magical command-line data processor.
https://github.com/yord/pxi-json
csv data-processing deserializer dsv json marshaller parser pixie pxi serializer ssv tsv
Last synced: 14 days ago
JSON representation
🧚pxi-json is a JSON plugin for pxi (pixie), the small, fast, and magical command-line data processor.
- Host: GitHub
- URL: https://github.com/yord/pxi-json
- Owner: Yord
- License: mit
- Created: 2019-12-09T09:58:27.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-01-05T02:56:20.000Z (about 3 years ago)
- Last Synced: 2025-05-24T01:51:35.917Z (10 months ago)
- Topics: csv, data-processing, deserializer, dsv, json, marshaller, parser, pixie, pxi, serializer, ssv, tsv
- Language: JavaScript
- Homepage:
- Size: 5.24 MB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
![pxi-json teaser][teaser]
🧚`pxi-json` is a JSON plugin for `pxi` (pixie), the small, fast, and magical command-line data processor.
See the [`pxi` github repository][pxi] for more details!
[![node version][shield-node]][node]
[![npm version][shield-npm]][npm-package]
[![license][shield-license]][license]
[![PRs Welcome][shield-prs]][contribute]
[![linux unit tests status][shield-unit-tests-linux]][actions]
[![macos unit tests status][shield-unit-tests-macos]][actions]
[![windows unit tests status][shield-unit-tests-windows]][actions]
## Installation
> :ok_hand: `pxi-json` comes preinstalled in `pxi`.
> No installation necessary.
> If you still want to install it, proceed as described below.
`pxi-json` is installed in `~/.pxi/` as follows:
```bash
npm install pxi-json
```
The plugin is included in `~/.pxi/index.js` as follows:
```js
const json = require('pxi-json')
module.exports = {
plugins: [json],
context: {},
defaults: {}
}
```
For a much more detailed description, see the [`.pxi` module documentation][pxi-module].
## Extensions
This plugin comes with the following `pxi` extensions:
| | Description |
|---------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `jsonObj` chunker | Searches the data for JSON objects and returns each object as a chunk. All data between objects is dropped. This is useful in a streaming context, or when deserializing files containing one big JSON list of JSON objects. |
| `json` deserializer | Deserializes data into JSON. Uses JSON.parse internally. |
| `json` serializer | Serializes transformed JSON into JSON using JSON.stringify. |
## Known Limitations
This plugin has the following limitations:
1. **No BigInt Support:**
Since JSON [does not support BigInt][json-bigint], `pxi-json` does not support it either.
If you need to pass BigInts, encode them as strings and not as numbers.
2. **No JSON-Stream Chunker for Non-Objects:**
Currently, `pxi-json` only ships with a JSON object chunker for data streams.
This may change in the future.
3. **Integer Key Ordering:**
The json serializer may order JSON object keys in surprising ways.
Keys that are integers are always moved to the beginning and sorted in ascending order.
All other keys come after these integer keys.
This is [how JavaScript generally handles object keys][json-keys-ordering] and `pxi-json` makes no exception.
## Reporting Issues
Please report issues [in the tracker][issues]!
## License
`pxi-json` is [MIT licensed][license].
[actions]: https://github.com/Yord/pxi-json/actions
[contribute]: https://github.com/Yord/pxi
[issues]: https://github.com/Yord/pxi/issues
[json-bigint]: https://stackoverflow.com/questions/18755125/node-js-is-there-any-proper-way-to-parse-json-with-large-numbers-long-bigint
[json-keys-ordering]: https://stackoverflow.com/questions/30076219/does-es6-introduce-a-well-defined-order-of-enumeration-for-object-properties#answer-30919039
[license]: https://github.com/Yord/pxi-json/blob/master/LICENSE
[node]: https://nodejs.org/
[npm-package]: https://www.npmjs.com/package/pxi-json
[pxi]: https://github.com/Yord/pxi
[pxi-module]: https://github.com/Yord/pxi#pxi-module
[shield-license]: https://img.shields.io/npm/l/pxi-json?color=yellow&labelColor=313A42
[shield-node]: https://img.shields.io/node/v/pxi-json?color=red&labelColor=313A42
[shield-npm]: https://img.shields.io/npm/v/pxi-json.svg?color=orange&labelColor=313A42
[shield-prs]: https://img.shields.io/badge/PRs-welcome-green.svg?labelColor=313A42
[shield-unit-tests-linux]: https://github.com/Yord/pxi-json/workflows/linux/badge.svg?branch=master
[shield-unit-tests-macos]: https://github.com/Yord/pxi-json/workflows/macos/badge.svg?branch=master
[shield-unit-tests-windows]: https://github.com/Yord/pxi-json/workflows/windows/badge.svg?branch=master
[teaser]: https://github.com/Yord/pxi/blob/master/teaser.gif?raw=true