< Back

Invoke-FixJSON

Mon Jan 13, 2020 7:27 pm

NAME Invoke-FixJSON



SYNOPSIS

Invoke-FixJSON

This PowerShell command'let will Fix a JSON file that doesn't have escape characters behind a special characters.





SYNTAX

Invoke-FixJSON [-Threads <Int32>] [<CommonParameters>]



Invoke-FixJSON -Folder <String> [-Threads <Int32>] [<CommonParameters>]



Invoke-FixJSON -File <String> [-Threads <Int32>] [<CommonParameters>]





DESCRIPTION

Invoke-FixJSON

This PowerShell command'let will Fix a JSON file that doesn't have escape characters behind a special characters.

Here is the list with all JSON special characters that must be escaped:



%x22 / ; " quotation mark U+0022

%x5C / ; \\ reverse solidus U+005C

%x2F / ; / solidus U+002F

%x62 / ; b backspace U+0008

%x66 / ; f form feed U+000C

%x6E / ; n line feed U+000A

%x72 / ; r carriage return U+000D

%x74 / ; t tab U+0009

%x75 4HEXDIG ) ; uXXXX U+XXXX





PARAMETERS

-Folder <String>



Required? true

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-File <String>



Required? true

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Threads <Int32>



Required? false

Position? named

Default value 0

Accept pipeline input? false

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:\\># Fixing all JSON files in a folder



If you have more than one file in a folder the command will simultaneously (Multithreading) process 4 files by

default.

Invoke-FixJSON -Folder C:\\JsonFiles









-------------------------- EXAMPLE 2 --------------------------



PS C:\\># Fixing all JSON files in a folder specifing how many files you would like to simultaneously process

(Multithreading)



By default it will process 4 files simultaneously (Multithreading)

Invoke-FixJSON -Folder C:\\JsonFiles -Threads 2

Invoke-FixJSON -Folder C:\\JsonFiles -Threads 6









-------------------------- EXAMPLE 3 --------------------------



PS C:\\># Fixing a single JSON file



Invoke-FixJSON -File C:\\JsonFiles\\jsonfile.json



# A URL to the main website for this project.

ProjectUri = 'https://github.com/welasco/FixEscapeJSON'

Resource = https://tools.ietf.org/html/rfc7159











RELATED LINKS