Add Format-Json function with docs and tests#6
Merged
Marius Storhaug (MariusStorhaug) merged 12 commits intomainfrom Jul 25, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds a new Format-Json function that provides JSON formatting capabilities with support for compact output and configurable indentation. The implementation includes comprehensive documentation and test coverage.
- Adds
Format-Jsonfunction with dual input modes (JSON string or PowerShell object) - Implements compact formatting and customizable indentation (spaces or tabs)
- Includes comprehensive Pester tests covering all formatting scenarios
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/functions/public/Format-Json.ps1 | Main function implementation with parameter validation and JSON formatting logic |
| tests/Format-Json.Tests.ps1 | Complete test suite covering compact mode, indentation options, and error handling |
Comments suppressed due to low confidence (1)
tests/Format-Json.Tests.ps1:49
- The function name 'LogGroup' appears to be undefined or a custom helper function. If this is a custom logging function, it should be properly defined or imported.
LogGroup 'compact from string' { $result }
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…g and additional examples
…of Write-Host for better readability; update tests in Json.Tests.ps1 to replace Write-Host with Out-String for consistent logging.
…roved logging visibility; update suppression messages for clarity.
…sistent key order
…in Format-Json function
Format-Json function with docs and tests
|
Module Json - 1.0.0 published to the PowerShell Gallery. |
|
GitHub release for Json v1.0.0 has been created. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces JSON formatting functionality with the addition of a new
Format-Jsonfunction.JSON Formatting
Format-Jsonfunction which implements functionality to format JSON strings or PowerShell objects with customizable indentation (spaces or tabs) and supports both pretty-printing and compact output. Includes robust error handling and pipeline compatibility.