package
Splits a JSON string into an annotated list of tokens
npm install json-tokenizeGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Tagged topics.
json-tokenize Splits a JSON string into an annotated list of tokens.
Screenshot - formatted tokens outputted to stdout
npm install --save json-tokenizeOr even better
yarn add json-tokenizeconst tokenize = require('json-tokenize')
const obj = { "test": 1.0 }
tokenize(JSON.stringify(obj))
// ->
[
{ type: 'punctuation',
position: { lineno: 1, column: 1 },
raw: '{',
value: '{' },
{ type: 'whitespace',
position: { start: [Object], end: [Object] },
raw: '\n ',
value: '\n ' },
{ type: 'string',
position: { start: [Object], end: [Object] },
{, }, [, ], : and ,true, false or nulljson-tokenize © Fabian Eichenberger, Released under the MIT License.
Authored and maintained by Fabian Eichenberger with help from contributors (list).