Created
May 24, 2014 09:57
-
-
Save edouard/b04be2562a03deb120b9 to your computer and use it in GitHub Desktop.
JSON file "null" to empty string converter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
############################################################################### | |
# JSON file "null" to empty string converter | |
# For use with WebTranslateIt and Google Chrome extension i18n files | |
# -WTI will spit out unproofread segments as "null" (without quotes), but | |
# Chrome needs missing segments to be empty strings | |
# -Replace "null" with an empty string so that the target files can still be | |
# properly marked as unproofread in the WTI UI | |
# Evan Shultz | |
# Neater Bookmarks | |
# [email protected] | |
# 23 May 2014 - v0.1 | |
############################################################################### | |
# search all reachable paths for files named messages.json | |
Get-ChildItem -path .\ -include messages.json -recurse | | |
Foreach-Object { | |
Write-Host "Procesing $_" | |
# replace '": null' with empty string write original or modified line | |
(Get-Content $_) -replace "`": null","`": `"`"" | Set-Content $_ | |
} | |
Write-Host "`n`nProcessing completed`nPress any key to continue ..." | |
$x = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment