Skip to content

Add Format-Json function with docs and tests#6

Merged
Marius Storhaug (MariusStorhaug) merged 12 commits intomainfrom
codex/create-comprehensive-feature-spec-for-format-json
Jul 25, 2025
Merged

Add Format-Json function with docs and tests#6
Marius Storhaug (MariusStorhaug) merged 12 commits intomainfrom
codex/create-comprehensive-feature-spec-for-format-json

Conversation

@MariusStorhaug
Copy link
Copy Markdown
Member

@MariusStorhaug Marius Storhaug (MariusStorhaug) commented Jul 23, 2025

This pull request introduces JSON formatting functionality with the addition of a new Format-Json function.

JSON Formatting

  • Added Format-Json function 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.

Copilot AI review requested due to automatic review settings July 23, 2025 21:05
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-Json function 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 }

@MariusStorhaug Marius Storhaug (MariusStorhaug) changed the title Add Format-Json function with docs and tests Add Format-Json function with docs and tests Jul 25, 2025
@MariusStorhaug Marius Storhaug (MariusStorhaug) merged commit 19b6030 into main Jul 25, 2025
36 checks passed
@MariusStorhaug Marius Storhaug (MariusStorhaug) deleted the codex/create-comprehensive-feature-spec-for-format-json branch July 25, 2025 10:14
@github-actions
Copy link
Copy Markdown

Module Json - 1.0.0 published to the PowerShell Gallery.

@github-actions
Copy link
Copy Markdown

GitHub release for Json v1.0.0 has been created.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🚀[Feature]: Format-Json

2 participants