Gathering detailed insights and metrics for fracturedjsonjs
Gathering detailed insights and metrics for fracturedjsonjs
Gathering detailed insights and metrics for fracturedjsonjs
Gathering detailed insights and metrics for fracturedjsonjs
JSON formatter that produces highly readable but fairly compact output.
npm install fracturedjsonjs
Typescript
Module System
Node Version
NPM Version
TypeScript (99.94%)
JavaScript (0.06%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
74 Stars
73 Commits
7 Forks
5 Watchers
1 Branches
2 Contributors
Updated on Jun 14, 2025
Latest Version
4.1.0
Package Id
fracturedjsonjs@4.1.0
Unpacked Size
166.35 kB
Size
39.47 kB
File Count
50
NPM Version
10.5.0
Node Version
20.12.0
Published on
Jun 04, 2025
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
5
FracturedJson is a family of utilities that format JSON data in a way that's easy for humans to read, but fairly compact. Arrays and objects are written on single lines, as long as they're neither too long nor too complex. When several such lines are similar in structure, they're written with fields aligned like a table. Long arrays are written with multiple items per line across multiple lines.
This npm
module is part of a family of FracturedJson tools.
Here's a sample of output using nearly-default settings:
1{ 2 "SimpleArray": [ 3 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 4 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113 5 ], 6 "ObjectColumnsArrayRows": { 7 "Katherine": ["blue" , "lightblue", "black" ], 8 "Logan" : ["yellow" , "blue" , "black", "red"], 9 "Erik" : ["red" , "purple" ], 10 "Jean" : ["lightgreen", "yellow" , "black" ] 11 }, 12 "ArrayColumnsObjectRows": [ 13 { "type": "turret" , "hp": 400, "loc": {"x": 47, "y": -4}, "flags": "S" }, 14 { "type": "assassin" , "hp": 80, "loc": {"x": 12, "y": 6}, "flags": "Q" }, 15 { "type": "berserker", "hp": 150, "loc": {"x": 0, "y": 0} }, 16 { "type": "pittrap" , "loc": {"x": 10, "y": -14}, "flags": "S,I" } 17 ], 18 "ComplexArray": [ 19 [19, 2], 20 [ 3, 8], 21 [14, 0], 22 [ 9, 9], 23 [ 9, 9], 24 [ 0, 3], 25 [10, 1], 26 [ 9, 1], 27 [ 9, 2], 28 [ 6, 13], 29 [18, 5], 30 [ 4, 11], 31 [12, 2] 32 ] 33}
If enabled in the settings, it can also handle JSON-with-comments (which isn't real JSON).
1{ 2 /* 3 * Multi-line comments 4 * are fun! 5 */ 6 "NumbersWithHex": [ 7 254 /*00FE*/, 1450 /*5AA*/ , 0 /*0000*/, 36000 /*8CA0*/, 10 /*000A*/, 8 199 /*00C7*/, 15001 /*3A99*/, 6540 /*198C*/ 9 ], 10 /* Elements are keen */ 11 "Elements": [ 12 { /*Carbon*/ "Symbol": "C" , "Number": 6, "Isotopes": [11, 12, 13, 14] }, 13 { /*Oxygen*/ "Symbol": "O" , "Number": 8, "Isotopes": [16, 18, 17 ] }, 14 { /*Hydrogen*/ "Symbol": "H" , "Number": 1, "Isotopes": [ 1, 2, 3 ] }, 15 { /*Iron*/ "Symbol": "Fe", "Number": 26, "Isotopes": [56, 54, 57, 58] } 16 // Not a complete list... 17 ], 18 19 "Beatles Songs": [ 20 "Taxman" , // George 21 "Hey Jude" , // Paul 22 "Act Naturally" , // Ringo 23 "Ticket To Ride" // John 24 ] 25}
1npm i fracturedjsonjs
1import { 2 Formatter, 3 FracturedJsonOptions, 4 CommentPolicy, 5 EolStyle, 6 NumberListAlignment, 7 TableCommaPlacement, 8} from 'fracturedjsonjs'; 9 10// The constructor below will give default behavior that is consistent across minor version 11// changes. But if you don't care about backward compatibility and just want the newest best 12// settings whatever they are, use this instead: 13// const options = FracturedJsonOptions.Recommended(); 14const options = new FracturedJsonOptions(); 15 16// For examples of the options, see: 17// https://github.com/j-brooke/FracturedJson/wiki/Options 18// Or experiment interactively with the web formatter: 19// https://j-brooke.github.io/FracturedJson/ 20options.MaxTotalLineLength = 80; 21options.MaxInlineComplexity = 1; 22options.JsonEolStyle = EolStyle.Crlf; 23options.NumberListAlignment = NumberListAlignment.Decimal; 24options.TableCommaPlacement = TableCommaPlacement.BeforePadding; 25 26const formatter = new Formatter(); 27formatter.Options = options; 28 29// Use Serialize to go from JavaScript data to JSON text. 30const inputObj = [ 31 { val: 123.456 }, 32 { val: 234567.8 }, 33 { val: 3 }, 34 { val: null }, 35 { val: 5.67890123 } 36]; 37 38const textFromObj = formatter.Serialize(inputObj); 39 40console.log("From inputObj:"); 41console.log(textFromObj); 42 43// Comments aren't allowed by default, but they're easy to enable. 44formatter.Options.CommentPolicy = CommentPolicy.Preserve; 45formatter.Options.IndentSpaces = 2; 46 47// Use Reformat to go from JSON text to JSON text. 48const inputText = '[{"a":123.456,"b":0,"c":0},{"a":234567.8,"b":0,"c":0},' 49 + '{"a":3,"b":0.00000,"c":7e2},{"a":null,"b":2e-1,"c":80e1},{"a":5.6789,"b":3.5e-1,"c":0}]'; 50const textFromText = formatter.Reformat(inputText); 51 52console.log("From inputText:"); 53console.log(textFromText);
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
1 existing vulnerabilities detected
Details
Reason
4 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 3
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More