You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

ZY.Lime

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ZY.Lime

A .NET library for query string parsing and stringifying.

1.0.0
nugetNuGet
Version published
Maintainers
1
Created
Source

Lime

Lime Fresh and Zesty Query String Management for .NET

Just like a squeeze of lime adds zest to a dish, Lime brings a fresh approach to managing query strings in .NET. Featuring modern .NET development practices like nullable reference types, async/await, and fluent interfaces for a smooth developer experience.

Features

  • Parse query strings into dictionaries and nested objects.
  • Convert dictionaries to query strings with customizable formatting options.
  • Support for different array serialization formats (e.g., brackets, indices, repeat, comma).
  • Configurable encoding and decoding using RFC3986 or RFC1738 standards.
  • Flexible compaction options to clean up data.

Installation

Install the package from NuGet:

dotnet add package ZY.Lime --version 1.0.0

Usage

Parsing a Query String

using Lime.Extensions;

string queryString = "?name=John&age=30&skills[]=CSharp&skills[]=JavaScript";
var parsedData = await queryString.ParseQueryStringAsync();

foreach (var item in parsedData)
{
    Console.WriteLine($"{item.Key}: {item.Value}");
}

Stringify a Dictionary

using Lime.Extensions;
using System.Collections.Generic;

var data = new Dictionary<string, object?>
{
    { "name", "John Doe" },
    { "age", 30 },
    { "skills", new List<string> { "CSharp", "JavaScript" } }
};

string queryString = await data.ToQueryStringAsync();
Console.WriteLine(queryString);

Configuration

var options = new LimeOptions()
    .SetFormatHandler(new Rfc1738FormatHandler()) // Use RFC1738 encoding
    .UseParserOptions(new ParserOptions { AllowDots = true })
    .UseStringifierOptions(new StringifierOptions { ArrayFormat = ArrayFormat.Brackets });

var manager = new QueryStringManager(options);

License

This project is licensed under the MIT License.

Keywords

query-string

FAQs

Package last updated on 17 Oct 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts