Tizzani.QueryStringSerializer 9.1.1

There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package Tizzani.QueryStringSerializer --version 9.1.1
                    
NuGet\Install-Package Tizzani.QueryStringSerializer -Version 9.1.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Tizzani.QueryStringSerializer" Version="9.1.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Tizzani.QueryStringSerializer" Version="9.1.1" />
                    
Directory.Packages.props
<PackageReference Include="Tizzani.QueryStringSerializer" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Tizzani.QueryStringSerializer --version 9.1.1
                    
#r "nuget: Tizzani.QueryStringSerializer, 9.1.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=Tizzani.QueryStringSerializer&version=9.1.1
                    
Install Tizzani.QueryStringSerializer as a Cake Addin
#tool nuget:?package=Tizzani.QueryStringSerializer&version=9.1.1
                    
Install Tizzani.QueryStringSerializer as a Cake Tool

<div align="center"> <h3><img src="https://raw.githubusercontent.com/erinnmclaughlin/Tizzani.QueryStringSerializer/main/assets/QssLogo.png" width="70"><br /><b>Query String Serializer</b></h3> <p><b>Lightweight serializer for query strings and .NET objects.</b></p> <div> <img alt="Nuget version" src="https://img.shields.io/nuget/v/tizzani.querystringserializer"> <img alt="Nuget downloads" src="https://img.shields.io/nuget/dt/tizzani.querystringserializer"> <img alt="GitHub last commit" src="https://img.shields.io/github/last-commit/erinnmclaughlin/Tizzani.QueryStringSerializer/main"> <img alt="GitHub Workflow Status (with event)" src="https://img.shields.io/github/actions/workflow/status/erinnmclaughlin/Tizzani.QueryStringSerializer/dotnet.yml"> </div> </div>

<hr />

Installation

Download from NuGet.

dotnet add package Tizzani.QueryStringSerializer --version 9.1.1

Example Usage

Serialization

var order = new Order
{
    Customer = new Customer { Name = "Jack Sparrow" },
    Items = new List<OrderItem>
    {
        new OrderItem { Description = "Rum", Quantity = 5 },
        new OrderItem { Description = "Jar of Dirt", Quantity = 1 }
    }
};

var queryString = QueryStringSerializer.Serialize(order);
// "Customer.Name=Jack+Sparrow&Items.Description=Rum&Items.Quantity=5&Items.Description=Jar+of+Dirt&Items.Quantity=1";

Deserialization

var queryString = "Customer.Name=Jack+Sparrow&Items.Description=Rum&Items.Quantity=5&Items.Description=Jar+of+Dirt&Items.Quantity=1";
var order = QueryStringSerializer.Deserialize<Order>(queryString);

Configuration

To configure how query strings are serialized, use QueryStringSerializerOptions.

enum Status { Placed, Canceled, Completed }
var order = new Order { Status = Status.Canceled };
var qs1 = QueryStringSerializer.Serialize(order); // "Status=Canceled"
var qs2 = QueryStringSerializer.Serialize(order, new() { EnumsAsStrings = false }); // "Status=1"
Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Tizzani.QueryStringSerializer:

Package Downloads
Tizzani.QueryStringSerializer.Blazor

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
9.2.0-preview1 336 5/22/2025
9.1.1 140 5/22/2025
9.1.0 134 5/22/2025
9.0.0 144 5/22/2025
8.0.0 2,147 1/1/2024
1.0.3 575 5/6/2022
1.0.2 545 5/6/2022
1.0.1 566 5/6/2022
1.0.0 457 5/5/2022