Skip to content

Simple module for extracting JSON objects from a string dump.

Notifications You must be signed in to change notification settings

esoodev/extract-json-string

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Simple module for extracting JSON objects from a string dump.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published