< Back

Set-NewtonsoftJsonSettings

Mon Jan 13, 2020 7:30 pm

NAME Set-NewtonsoftJsonSettings



SYNOPSIS

Sets the default global Newtonsoft Json Settings object.





SYNTAX

Set-NewtonsoftJsonSettings [-Settings] <JsonSerializerSettings> [<CommonParameters>]





DESCRIPTION

If a settings object is not passed to ConvertTo-NewtonsoftJson,

then the function attempts to get the global default settings object.



By default, one is created with the camel casing converter enabled.



The global object can be changed by calling this cmdlet:

Set-NewtonsoftJsonSettings





PARAMETERS

-Settings <JsonSerializerSettings>

Mandatory. The settings object that will be used as the default

global settings object.



Required? true

Position? 1

Default value

Accept pipeline input? true (ByValue)

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS



-------------------------- EXAMPLE 1 --------------------------



PS C:\\>$settings = New-NewtonsoftJsonSettings



PS C:\\>$camelCaseResolver = "Newtonsoft.Json.Serialization.CamelCasePropertyNamesContractResolver"

PS C:\\>$settings.ContractResolver = New-Object $camelCaseResolver

PS C:\\>Set-NewtonsoftJsonSettings $settings











RELATED LINKS