forked from kmann3/stfc-data
-
Notifications
You must be signed in to change notification settings - Fork 0
/
concat-json.ps1
34 lines (30 loc) · 991 Bytes
/
concat-json.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#requires -version 2
<#
.SYNOPSIS
Script gets a list of officer, ship, and system JSON files.
It converts them to raw format.
Appends them into one massive variable.
When loop is done, outputs to concatenated data to a file.
.DESCRIPTION
Merge all useful JSON data into one massive JSON file for easy transport or parsing.
.INPUTS
None
.OUTPUTS
Creates a compressed JSON file for the data.
Data is compressed because it will rarely, if ever, be read by a human.
.NOTES
Version: 1.0
Author: Kenny Mann
Creation Date: 2021-01-14
Purpose/Change: Initial script development
.EXAMPLE
> concat-json.ps1
#>
$allData = @()
$fileList = Get-ChildItem -Name -Include officer*.json,ship*,json,system*.json -Attributes !Directory
ForEach($file in $fileList) {
$data = Get-Content -Path $file -Raw | ConvertFrom-Json
Write-Output $data
$allData += $data
}
$allData | ConvertTo-Json -Depth 20 -compress | Out-File -FilePath combinedFiles.json