Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mkht/dscr_jsonfile
PowerShell DSC Resource to create JSON format file
https://github.com/mkht/dscr_jsonfile
Last synced: about 1 month ago
JSON representation
PowerShell DSC Resource to create JSON format file
- Host: GitHub
- URL: https://github.com/mkht/dscr_jsonfile
- Owner: mkht
- License: mit
- Created: 2018-07-10T11:04:07.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-10-28T06:09:54.000Z (about 6 years ago)
- Last Synced: 2024-10-30T17:13:03.497Z (about 2 months ago)
- Language: PowerShell
- Size: 29.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
DSCR_JsonFile
====## This repository is no longer maintained ! :no_entry:
Please use [DSCR_FileContent](https://github.com/mkht/DSCR_FileContent/) module.----
PowerShell DSC Resource to create JSON format file.## Install
You can install Resource through [PowerShell Gallery](https://www.powershellgallery.com/packages/DSCR_JsonFile/).
```Powershell
Install-Module -Name DSCR_JsonFile
```## Properties
+ [string] **Ensure** (Write):
+ Specify the key exists or not.
+ The default value is `Present`. (`Present` | `Absent`)+ [string] **Path** (Key):
+ The path of the JSON file.+ [string] **Key** (Key):
+ Key element.+ [string] **Value** (Key):
+ The value corresponding to the key.
+ The value of this parameter must be a JSON formatted string.+ [string] **Encoding** (Write):
+ You can choose text encoding for the JSON file.
+ utf8NoBOM (default) / utf8BOM / utf32 / unicode / bigendianunicode / ascii+ [string] **NewLine** (Write):
+ You can choose new line code for the JSON file.
+ CRLF (default) / LF## Examples
+ **Example 1**: Sample configuration
```Powershell
Configuration Example1 {
Import-DscResource -ModuleName DSCR_JsonFile
cJsonFile String {
Path = 'C:\Test.json'
Key = 'StringValue'
Value = '"Apple"'
}
cJsonFile Bool {
Path = 'C:\Test.json'
Key = 'BoolValue'
Value = 'true'
}
cJsonFile Array {
Path = 'C:\Test.json'
Key = "ArrayValue"
Value = '[true, 123, "banana"]'
}
}
```The result of executing the above configuration, the following JSON file will output to `C:\Test.json`
```json
{
"BoolValue": true,
"StringValue": "Apple",
"ArrayValue": [
true,
123,
"banana"
]
}
```----
## ChangeLog
### 0.2.3
+ Fixed an issue that Set-TargetResource fails when the parent folder of the `Path` is not exist.### 0.2.2
+ Fix casing miss of the module name
+ Remove unnecessary files in the published package### 0.2.0
+ Initial public release