Skip to content

json-miner extracts json(s) from log dump and mixed string

License

Notifications You must be signed in to change notification settings

twskj/node-json-miner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

node-json-miner

json-miner extracts json(s) out of text dump

Install

npm install --save json-miner

Usage

const json_miner = require("json-miner");
var obj = { "hello": "world", "embeded": '{"hello":"world"}'};
var text = `[Dec-25-2018 00:00:00] ${JSON.stringify(obj)} STATUS: OK, ${JSON.stringify(obj,null,2)}, Random suffix }`
var result = json_miner.dig(text);
console.log(result); // result is an array of string

.dig(str [, return_index_mode])

  • str <string> - String to be searched
  • return_index_mode boolean - When set to true result will be in a form of [[start_index,end_index]]. default to false

About

json-miner extracts json(s) from log dump and mixed string

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published