- Updated to using System.Text.Json version 6.0.10 to address a vulnerability.
- Fixed a bug where an exception is thrown if the current locale uses a number format that's incompatible with JSON's number representation. (E.g., a locale that uses "," instead of "." as the decimal separator.)
- Fixed a bug where no exception is thrown when there's a property name but no value at the end of an object.
Replaced setting DontJustifyNumbers
with a new enum, NumberListAlignment
, to control how arrays or table columns of numbers are handled.
Normalize
is the default and it behaves like previous versions whenDontJustifyNumbers==false
. With it, number lists or columns are rewritten with the same number of digits after the decimal place.Decimal
lines the numbers up according to their decimal points, preserving the number exactly as it appeared in the input document. For regular numbers this usually looks likeNormalize
, except with spaces padding out the extra decimal places instead of zeros.Left
lines up the values on the left, preserving the exactly values from the input document.Right
lines up the values on the right, preserving the exactly values from the input document.
New setting, NumberListAlignment
.
Removed setting DontJustifyNumbers
.
- Fixed a bug where numbers that overflow or underflow a 64-bit float could (depending on settings) be written to the output as
Infinity
or0
. In the overflow case, that caused output to be invalid JSON. With this fix, FracturedJson recognizes that it can't safely reform numbers like this, and uses the exact number representation from the original document.
- New setting:
OmitTrailingWhitespace
. When true, the output JSON won't have any trailing spaces or tabs. This is probably the preferred behavior in most cases, but the default isfalse
for backward compatibility.
- Fixed a bug where the AlwaysExpandDepth setting was preventing table formatting.
- Fixed a problem where top level comments weren't being ignored when the settings said they should.
- Fixed a problem where more than one top-level element (actual data, not comments) would be processed.
- Support for comments (sometimes called JSON-with-comments or .jsonc). Where possible, comments stay stuck to the elements that they're closest to in the input.
- Deep table formatting. In version 2, only the immediate children of table rows were lined up. Now, if space permits and the types are consistent, all descendants are aligned as table columns.
- New length limit option:
MaxTotalLineLength
. - Option to preserve blank lines.
- Option to allow trailing commas.
- New settings:
MaxTotalLineLength
,MaxTableRowComplexity
,MinCompactArrayRowItems
,CommentPolicy
,PreserveBlankLines
,AllowTrailingCommas
.
- Removed settings:
TableObjectMinimumSimilarity
,TableArrayMinimumSimilarity
,AlignExpandedPropertyNames
,JsonSerializerOptions
. - Support for East Asian Full-width characters is no longer built-in. I did this to eliminate coupling with any specific library. You can easily recreate the functionality by providing your own
StringLengthFunc
. (See theEastAsianWideCharactersTests
test class for an example.)
- All of the settings are now bundled in a single class,
FracturedJsonOptions
. They are now set all at once toFormatter.Options
rather than being separate properties ofFormatter
. - Method names have changed. Use
Reformat
when you're providing a JSON text, orSerialize<T>
when providing .NET objects.
- Fixed a bug caused by numbers with superfluous digits when
DontJustifyNumbers
istrue
.
- New property
StringWidthFunc
determines how many spaces are used as padding to line up columns when formatted as a table.- Static method
Formatter.StringWidthWithEastAsian
(default) uses two spaces for East Asian "fullwidth" symbols, and one space for others. - Static method
Formatter.StringWidthByCharacterCount
treats each character as having the width of one space.
- Static method
- New property
SimpleBracketPadding
controls whether brackets should have spaces inside when they contain only simple elements. (The old propertyNestedBracketPadding
is used when they contain other arrays/objects.)
- Escape sequences in property names are not preserved (#3)
Re-written to support table-formatting. When an expanded array or object is composed of highly similar inline arrays or objects, FracturedJson tries to format them in a tabular format, sorting properties and justifying values to make everything line up neatly.
- New properties
IndentSpaces
andUseTabToIndent
to control indentation. - New properties
TableObjectMinimumSimilarity
andTableArrayMinimumSimilarity
control how alike inline sibling elements need to be to be formatted as a table. - New property
AlignExpandedPropertyNames
to line up expanded object property names even when not treated as a table. - New property
DontJustifyNumbers
prevents numbers from being right-justified and set to matching precision. - New property
PrefixString
allows adding arbitrary characters at the start of each line. - Commandline flags
--array
,--object
,--no-justify
have been added corresponding to the new Formatter properties.
JustifyNumberLists
property has been removed. The new table formatting covers this functionality better.IndentString
property has been removed.IndentSpaces
andUseTabToIndent
are used to control indentation instead. The flexibility intended forIndentString
turned out not to be worth the confusion.- Commandline flag
--justify
has been removed.
- Formatter property
JsonSerializerOptions
replaces theoptions
parameter ofSerialize<T>
.