![]() |
VOOZH | about |
dotnet add package Microsoft.Azure.Core.NewtonsoftJson --version 2.0.0
NuGet\Install-Package Microsoft.Azure.Core.NewtonsoftJson -Version 2.0.0
<PackageReference Include="Microsoft.Azure.Core.NewtonsoftJson" Version="2.0.0" />
<PackageVersion Include="Microsoft.Azure.Core.NewtonsoftJson" Version="2.0.0" />Directory.Packages.props
<PackageReference Include="Microsoft.Azure.Core.NewtonsoftJson" />Project file
paket add Microsoft.Azure.Core.NewtonsoftJson --version 2.0.0
#r "nuget: Microsoft.Azure.Core.NewtonsoftJson, 2.0.0"
#:package Microsoft.Azure.Core.NewtonsoftJson@2.0.0
#addin nuget:?package=Microsoft.Azure.Core.NewtonsoftJson&version=2.0.0Install as a Cake Addin
#tool nuget:?package=Microsoft.Azure.Core.NewtonsoftJson&version=2.0.0Install as a Cake Tool
The Azure.Core package contains types shared by the latest Azure SDK client libraries. This Newtonsoft.Json compatibility library:
Newtonsoft.Json. Those custom model types may then be used with the following client libraries:
Install this package from NuGet using the .NET CLI:
dotnet add package Microsoft.Azure.Core.NewtonsoftJson
This support package contains the NewtonsoftJsonObjectSerializer class which can be passed to some Azure SDKs' client options classes, as shown in the examples below.
The following converters are added automatically to the NewtonsoftJsonObjectSerializer if you do not pass your own JsonSerializerSettings:
NewtonsoftJsonETagConverter to convert Azure.ETag properties.See the example Using default converters below for getting an instance of JsonSerializerSettings with this default list you can then modify as needed.
The Azure.Search.Documents package is used in examples to show how search results can be deserialized. For more information and examples using Azure.Search.Documents, see its README.
Consider a custom model class containing information about movies:
public class Movie
{
[JsonProperty("uuid")]
public string Id { get; private set; } = Guid.NewGuid().ToString();
public string Title { get; set; }
public string Description { get; set; }
public float Rating { get; set; }
}
Our Azure Cognitive Search index is defined using camelCase fields, and the Id field is actually defined as "uuid"; however, we can provide an idiomatic model without having to attribute all properties by setting the JsonSerializerSettings.ContractResolver property as shown below:
// Get the Azure Cognitive Search endpoint and read-only API key.
Uri endpoint = new Uri(Environment.GetEnvironmentVariable("SEARCH_ENDPOINT"));
AzureKeyCredential credential = new AzureKeyCredential(Environment.GetEnvironmentVariable("SEARCH_API_KEY"));
// Create serializer options with default converters for Azure SDKs.
JsonSerializerSettings serializerSettings = NewtonsoftJsonObjectSerializer.CreateJsonSerializerSettings();
// Serialize property names using camelCase by default.
serializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
SearchClientOptions clientOptions = new SearchClientOptions
{
Serializer = new NewtonsoftJsonObjectSerializer(serializerSettings)
};
SearchClient client = new SearchClient(endpoint, "movies", credential, clientOptions);
Response<SearchResults<Movie>> results = client.Search<Movie>("Return of the King");
foreach (SearchResult<Movie> result in results.Value.GetResults())
{
Movie movie = result.Document;
Console.WriteLine(movie.Title);
Console.WriteLine(movie.Description);
Console.WriteLine($"Rating: {movie.Rating}\n");
}
If searching an index full of movies, the following may be printed:
The Lord of the Rings: The Return of the King
Gandalf and Aragorn lead the World of Men against Sauron's army to draw his gaze from Frodo and Sam as they approach Mount Doom with the One Ring.
Rating: 9.1
If you instantiate a NewtonsoftJsonObjectSerializer using the default constructor, some converters for common Azure SDKs are added automatically as listed above in Key concepts. To modify these default settings, you can create a new JsonSerializerSettings like in the following example:
JsonSerializerSettings serializerSettings = NewtonsoftJsonObjectSerializer.CreateJsonSerializerSettings();
// Serialize property names using camelCase by default.
serializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
// Add converters as needed, for example, to convert movie genres to an enum.
serializerSettings.Converters.Add(new StringEnumConverter());
SearchClientOptions clientOptions = new SearchClientOptions
{
Serializer = new NewtonsoftJsonObjectSerializer(serializerSettings)
};
You can add or remove converters, set the ContractResolver, or any other members of JsonSerializerSettings you need.
This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.
When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repositories using our CLA.
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 was computed. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 was computed. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 netcoreapp2.0 was computed. netcoreapp2.1 netcoreapp2.1 was computed. netcoreapp2.2 netcoreapp2.2 was computed. netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 netstandard2.0 is compatible. netstandard2.1 netstandard2.1 was computed. |
| .NET Framework | net461 net461 was computed. net462 net462 was computed. net463 net463 was computed. net47 net47 was computed. net471 net471 was computed. net472 net472 was computed. net48 net48 was computed. net481 net481 was computed. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen40 tizen40 was computed. tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
Showing the top 5 NuGet packages that depend on Microsoft.Azure.Core.NewtonsoftJson:
| Package | Downloads |
|---|---|
|
Microsoft.Azure.SignalR.Management
Provides communication capabilities with ASP.NET Core SignalR clients through Azure SignalR Service directly. The capabilities include sending messages to all/clients/users/groups and managing group membership. For more information, see https://github.com/Azure/azure-signalr/blob/dev/docs/management-sdk-guide.md |
|
|
Microsoft.Azure.WebJobs.Extensions.CosmosDB
This package contains binding extensions for Azure Cosmos DB. |
|
|
Microsoft.Azure.Functions.Worker.Extensions.OpenApi
This package helps render OpenAPI document and Swagger UI of Azure Functions endpoints through the out-of-process worker. |
|
|
nostify
Package Description |
|
|
Dan.Common
This package includes the common models and utilities used for communicating between Dan.Core and the various Dan plugins and simplifying plugin development. |
Showing the top 4 popular GitHub repositories that depend on Microsoft.Azure.Core.NewtonsoftJson:
| Repository | Stars |
|---|---|
|
Azure/azure-functions-dotnet-worker
Azure Functions out-of-process .NET language worker
|
|
|
Azure/azure-signalr
Azure SignalR Service SDK for .NET
|
|
|
Azure/azure-functions-openapi-extension
This extension provides an Azure Functions app with Open API capability for better discoverability to consuming parties
|
|
|
Azure/azure-webjobs-sdk-extensions
Azure WebJobs SDK Extensions
|
| Version | Downloads | Last Updated |
|---|---|---|
| 2.0.0 | 5,838,747 | 12/14/2023 |
| 1.0.0 | 25,963,485 | 1/8/2021 |
| 1.0.0-preview.1 | 2,143 | 8/7/2020 |