flatten-json-pipe
Pipe JSON in, get it flattened on the way out
Last updated 5 years ago by radekstepan .
AGPL-3.0 · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install flatten-json-pipe 
SYNC missed versions from official npm registry.

#flatten-json-pipe

Pipe JSON in, get it flattened on the way out.

Build Status Dependencies License

##Run

Install with npm.

$ npm install flatten-json-pipe -g

Pipe through passing an optional delimiter.

$ echo '{"A":{"name":"Peter"},"B":{"val":[\"a\",\"b\"]}}' | flatten-json-pipe '.'

You get the following back:

{
  "A.name": "Peter",
  "B.val.0": "a",
  "B.val.1": "b"
}

##Source

_      = require 'highland'
ndjson = require 'ndjson'
flat   = require 'flat'

module.exports = (delimiter='.') ->
  through = (obj) -> flat obj, { delimiter }

  _.pipeline.apply _, [
    do _
    do ndjson.parse
    _.map through
    do ndjson.stringify
  ]

Current Tags

  • 0.0.2                                ...           latest (5 years ago)

3 Versions

  • 0.0.2                                ...           5 years ago
  • 0.0.1                                ...           5 years ago
  • 0.0.0                                ...           5 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (4)
Dev Dependencies (3)
Dependents (2)

Copyright 2014 - 2016 © taobao.org |