New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

extract-json-string

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

extract-json-string

Simple module for extracting JSON objects from a string dump.

latest
Source
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

extract-json-string

Simple module for extracting JSON objects from a string dump.

Usage

Return an array of objects from a string containing stringified JSON objects.

var ejs = require('extract-json-string')

const logdump = `
    18:28:54,289 [83] INFO Files Process Start.... 
    // having mismatched braces { works
    // having erroneous JSON-like { key : value } doesn't
    // break the program
    18:28:55,289 [83] INFO Files Process Start....
    18:28:56,289 [83] INFO Files Process Start....
    {
        "name" : "Nathan"
        "likes" : ["guitar", "Yuqing", "Tori"]
        "age" : 25
    }
    18:28:57,289 [83] INFO Files Process Start....
    18:29:00,289 [83] INFO Files Process Start....
    {
        "name" : "Yuqing"
        "likes" : ["China", "brain", "eyeballs"]
        "age" : 21
    } etc...
`
var objs = ejs.extract(logdump)
console.log(objs)

Updates

Keywords

json

FAQs

Package last updated on 15 Sep 2017

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