Latest Threat ResearchGlassWorm Loader Hits Open VSX via Developer Account Compromise.Details
Socket
Book a DemoInstallSign in
Socket

jsonl

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jsonl

Transform a stream of JSON into a stream of Line Delimited JSON

Source
npmnpm
Version
1.1.1
Version published
Weekly downloads
322
27.78%
Maintainers
1
Weekly downloads
 
Created
Source

jso\nl

Transform a stream of JSON into a stream of Line Delimited JSON

Install

$ npm install --save jsonl

Use

var jsonl = require("jsonl")
var request = require("request")
var zlib = require("zlib")

var jeopardyQuestions = "http://skeeto.s3.amazonaws.com/share/JEOPARDY_QUESTIONS1.json.gz"

request.get(jeopardyQuestions)
  .pipe(zlib.Gunzip())
  .pipe(jsonl())
  .pipe(process.stdout)

Plucking

You can also select specific fields to be plucked out of the incoming object. In the case below, we are taking the same incoming data as the example above, but selecting only the "category" and "question" properties.

API

var jsonl = require("jsonl")([opts])

opts.depth

  • Type: Number (default: 1)

The depth of the objects in the incoming data to pluck out. This is what you want for an array of objects, such as:

[{"this":"that"},{"this":"that"}]

opts.objectMode

  • Type: Boolean (default: false)

Convert data into an object stream.

opts.pluck

  • Type: Array|String (default: [])

Only return select properties from JSON objects.

opts.separator

  • Type: String (default: \n)

String to separate object data with.

opts.toBufferStream

  • Type: Boolean (default: false)

Set this to true when you have an object stream that you would like converted to a stream of line delimited JSON buffers.

If set, this defaults opts.depth to 0, but can still be overridden.

License

MIT © Stephen Sawchuk

Keywords

json

FAQs

Package last updated on 02 Nov 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts