AspNetCore.UnquotedJson
1.0.27
dotnet add package AspNetCore.UnquotedJson --version 1.0.27
NuGet\Install-Package AspNetCore.UnquotedJson -Version 1.0.27
<PackageReference Include="AspNetCore.UnquotedJson" Version="1.0.27" />
<PackageVersion Include="AspNetCore.UnquotedJson" Version="1.0.27" />
<PackageReference Include="AspNetCore.UnquotedJson" />
paket add AspNetCore.UnquotedJson --version 1.0.27
#r "nuget: AspNetCore.UnquotedJson, 1.0.27"
#addin nuget:?package=AspNetCore.UnquotedJson&version=1.0.27
#tool nuget:?package=AspNetCore.UnquotedJson&version=1.0.27
AspNetCore.UnquotedJson
This NuGet package provides the ability to integrate the UnquotedJson
into the ASP.NET to replace the built-in Json serializer.
The Usage
Build an ASP.NET Core Web App, and install following NuGet packages:
install-package Microsoft.AspNetCore.SpaServices.Extensions
install-package AspNetCore.UnquotedJson
namespace
open AspNetCore.UnquotedJson
How to serialize The return value of the controller's actions as JSON
in Startup.cs
file, Modify the method ConfigureServices
to add dependency injection to it:
public void ConfigureServices(IServiceCollection services) {
...
services.Replace(ServiceDescriptor.Singleton<IActionResultExecutor<ObjectResult>, ObjectResultExecutor>());
}
This configuration means that UnquotedJson
has been integrated into ASP.NET to replace the built-in json serializer.
[<HttpGet>]
member this.action() =
...
data
data will be serialized as json using the UnquotedJson
serializer, which is ASP.NET's serializer.
To read Request.Query
In a controller's actions, The Method to read Request.Query
is as follows:
[<HttpGet>]
member this.kvps() =
let kvps = this.Request.Query |> Query.toPairs
...
where the type of kvps
is seq<string*string>
.
For example, a request's url query string is:
?foo=bar&baz=[qux,quux]
The kvps corresponding to the query string are parsed as follows:
[
["foo","bar"],
["baz","[qux,quux]"]
]
Product | Versions 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. |
-
net9.0
- FSharp.Core (>= 9.0.300)
- FSharp.Idioms (>= 1.4.32)
- UnquotedJson (>= 1.0.27)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
update fsharp.idioms