Giter Club home page Giter Club logo

o9d-json's Introduction

Json Icon

JSON Extensions

NuGet NuGet License

Build Coverage Status Quality Gate Status

Extensions for System.Text.Json.

Quick Start

Add the O9d.Json.Formatting package from NuGet

dotnet add package O9d.Json.Formatting

If you want to use a pre-release package, you can download them GitHub packages.

Features

Snake Case Formatting

This O9d.Json.Formatting library adds support for snake_case formatting to System.Text.Json which is still missing. The included implementation originates from the Newtonsoft.Json project.

To configure snake case formatting when using JsonSerializer directly:

var options = new JsonSerializerOptions()
{
    PropertyNamingPolicy = new JsonSnakeCaseNamingPolicy()
};

string json = JsonSerializer.Serialize(someObj, options);

To configure snake case formatting in an ASP.NET Core MVC project:

services.AddControllers()
    .AddJsonOptions(options => 
    {
        options.JsonSerializerOptions.PropertyNamingPolicy = new JsonSnakeCaseNamingPolicy()
    });

Or in ASP.NET 6.0 Minimal APIs:

builder.Services.Configure<JsonOptions>(options =>
{
    options.SerializerOptions.PropertyNamingPolicy = new JsonSnakeCaseNamingPolicy());
});

Pre-release Packages

Pre-release packages can be downloaded from GitHub Packages.

dotnet add package O9d.Json.Formatting --prerelease --source https://nuget.pkg.github.com/benfoster/index.json

More information on using GitHub packages with .NET.

Building locally

This project uses Cake to build, test and publish packages.

Run build.sh (Mac/Linux) or build.ps1 (Windows) To build and test the project.

This will output NuGet packages and coverage reports in the artifacts directory.

Contributing

To contribute to O9d.Json, fork the repository and raise a PR. If your change is substantial please open an issue first to discuss your objective.

Docs

The JSON documentation is built using DocFx. To build and serve the docs locally run:

./build.sh --target ServeDocs

This will serve the docs on http://localhost:8080.

o9d-json's People

Contributors

benfoster avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.