Skip to content

Releases: devlooped/json5

v1.0.4

13 Apr 21:30
0827fc7

Choose a tag to compare

v1.0.3

13 Apr 17:58
2b135a9

Choose a tag to compare

What's Changed

✨ Implemented enhancements

  • Add Visual Studio grammar for JSON5 by @kzu in #14

🔨 Other

  • Build VSIX separately on Windows by @kzu in #15

Full Changelog: v1.0.2...v1.0.3

Sponsors

The following sponsors made this release possible: @clarius, @MFB-Technologies-Inc, @khamza85, @sandrock, @drivenet, @Keflon, @tbolon, @kfrancis, @rbnswartz, @jfoshee, @Mrxx99, @eajhnsn1, @Jonathan-Hickey, @KenBonny, @SimonCropp, @agileworks-eu, @arsdragonfly, @vezel-dev, @ChilliCream, @4OTC, @DominicSchell, @adalon, @torutek, @mccaffers, @SeikaLogiciel, @wizardness, @latonz, @prime167.

Thanks 💜

v1.0.2

08 Apr 16:30
0961482

Choose a tag to compare

What's Changed

✨ Implemented enhancements

  • Allow passing JSON5 reader options in config by @kzu in #12

Full Changelog: v1.0.1...v1.0.2

Sponsors

The following sponsors made this release possible: @clarius, @MFB-Technologies-Inc, @khamza85, @sandrock, @drivenet, @Keflon, @tbolon, @kfrancis, @unoplatform, @rbnswartz, @jfoshee, @Mrxx99, @eajhnsn1, @Jonathan-Hickey, @KenBonny, @SimonCropp, @agileworks-eu, @arsdragonfly, @vezel-dev, @ChilliCream, @4OTC, @DominicSchell, @adalon, @torutek, @mccaffers, @SeikaLogiciel, @wizardness, @latonz.

Thanks 💜

v1.0.1

08 Apr 04:26

Choose a tag to compare

What's Changed

📝 Documentation updates

Full Changelog: v1.0.0...v1.0.1

Sponsors

The following sponsors made this release possible: @clarius, @MFB-Technologies-Inc, @khamza85, @sandrock, @drivenet, @Keflon, @tbolon, @kfrancis, @unoplatform, @rbnswartz, @jfoshee, @Mrxx99, @eajhnsn1, @Jonathan-Hickey, @KenBonny, @SimonCropp, @agileworks-eu, @arsdragonfly, @vezel-dev, @ChilliCream, @4OTC, @DominicSchell, @adalon, @torutek, @mccaffers, @SeikaLogiciel, @wizardness, @latonz.

Thanks 💜

v1.0.0

08 Apr 03:31

Choose a tag to compare

✨ Implemented enhancements

Json5 Parser

Full JSON5 spec parser for .NET 10+ built entirely on top of the public System.Text.Json API surface.

All JSON5 extensions are supported:

Feature Example
Unquoted object keys { foo: 1 }
Single-quoted strings 'hello'
Multi-line strings (escaped newlines) 'line1\↵line2'
Hexadecimal numbers 0xFF
Leading/trailing decimal points .5, 2.
Explicit positive sign +1
Infinity, -Infinity, NaN Infinity
Single and multi-line comments // … and /* … */
Trailing commas [1, 2,]
Additional escape sequences \v, \0, \xHH
Extended whitespace Unicode Zs category, BOM

Flexible Output Targets

Parse JSON5 to any System.Text.Json type:

// Parse to JsonNode
JsonNode? node = Json5.Parse(json5String);

// Deserialize to typed object
var config = Json5.Deserialize<AppConfig>(json5String);

// Parse to JsonDocument
using var doc = Json5.ParseDocument(json5String);

// Convert to standard JSON string or bytes
string json = Json5.ToJson(json5String);
byte[] utf8 = Json5.ToUtf8Json(json5Bytes);

// Write directly to Utf8JsonWriter
Json5.WriteTo(json5String, writer);

Auto-Dedent Multi-line Strings

Json5ReaderOptions.AutoDedent automatically strips common leading whitespace from multi-line string values, keeping source readable without polluting string content:

var options = new Json5ReaderOptions { AutoDedent = true };
var node = Json5.Parse("""
    {
        description: '
            This is a multi-line string
            with consistent indentation
            that will be removed.
        '
    }
    """, options);

Configurable Infinity / NaN Handling

Standard JSON has no representation for Infinity and NaN. Control the behavior via Json5ReaderOptions.SpecialNumbers:

Mode Behavior
AsString (default) Emits as "Infinity", "-Infinity", or "NaN"
AsNull Emits as null
Throw Throws Json5Exception

Json5.Configuration Package

Integrates JSON5 files with Microsoft.Extensions.Configuration, enabling JSON5 anywhere standard JSON config is used — with full support for comments, trailing commas, and unquoted keys:

var config = new ConfigurationBuilder()
    .AddJson5File("appsettings.json5")
    .AddJson5File("appsettings.Development.json5", optional: true, reloadOnChange: true)
    .Build();

Stream-based loading is also supported via AddJson5Stream, and all Json5ReaderOptions (special number handling, max depth, auto-dedent) are accessible through the source action overload.

Full Changelog: https://github.com/devlooped/json5/commits/v1.0.0

Sponsors

The following sponsors made this release possible: @clarius, @MFB-Technologies-Inc, @khamza85, @sandrock, @drivenet, @Keflon, @tbolon, @kfrancis, @unoplatform, @rbnswartz, @jfoshee, @Mrxx99, @eajhnsn1, @Jonathan-Hickey, @KenBonny, @SimonCropp, @agileworks-eu, @arsdragonfly, @vezel-dev, @ChilliCream, @4OTC, @DominicSchell, @adalon, @torutek, @mccaffers, @SeikaLogiciel, @wizardness, @latonz.

Thanks 💜