🚀 Add Export-Json function for exporting JSON data to files#8
🚀 Add Export-Json function for exporting JSON data to files#8Marius Storhaug (MariusStorhaug) merged 16 commits intomainfrom
Conversation
Co-authored-by: MariusStorhaug <17722253+MariusStorhaug@users.noreply.github.com>
Co-authored-by: MariusStorhaug <17722253+MariusStorhaug@users.noreply.github.com>
Co-authored-by: MariusStorhaug <17722253+MariusStorhaug@users.noreply.github.com>
|
Error: [-] Should use '$null = ...' instead of '... | Out-Null' (ID: OutNull) 25ms (24ms|1ms)
|
|
RuleName Severity ScriptName Line Message PSAvoidTrailingWhitespace Information Json.Tests 697 Line has trai RuleName Severity ScriptName Line Message PSAlignAssignmentStatement Warning General.ps 231 Assignment st RuleName Severity ScriptName Line Message PSPlaceCloseBrace Warning Export-Jso 146 Close brace b |
Co-authored-by: MariusStorhaug <17722253+MariusStorhaug@users.noreply.github.com>
Fixed the linting issue by replacing |
…d fix brace placement Co-authored-by: MariusStorhaug <17722253+MariusStorhaug@users.noreply.github.com>
Fixed all linting issues:
All PowerShell files now pass syntax validation and follow proper formatting standards. (9d0633d) |
…bility Co-authored-by: MariusStorhaug <17722253+MariusStorhaug@users.noreply.github.com>
Co-authored-by: MariusStorhaug <17722253+MariusStorhaug@users.noreply.github.com>
…e upfront Co-authored-by: MariusStorhaug <17722253+MariusStorhaug@users.noreply.github.com>
…adability Co-authored-by: MariusStorhaug <17722253+MariusStorhaug@users.noreply.github.com>
Co-authored-by: MariusStorhaug <17722253+MariusStorhaug@users.noreply.github.com>
|
Correct the tests for Format-Json to expect indents x 2 spaces by default, instead of 4. |
Co-authored-by: MariusStorhaug <17722253+MariusStorhaug@users.noreply.github.com>
Updated the Format-Json test data to use 2-space indentation instead of 4-space to match the new default IndentationSize. The $prettyJson test data in the BeforeAll section now correctly uses 2-space indentation, ensuring consistency with the updated default parameter value. All tests are now passing. (0272237) |
Co-authored-by: MariusStorhaug <17722253+MariusStorhaug@users.noreply.github.com>
|
Module Json - 1.2.0 published to the PowerShell Gallery. |
|
GitHub release for Json v1.2.0 has been created. |
This PR implements the
Export-Jsonfunction to complete the JSON module's core functionality, providing a comprehensive solution for JSON file operations alongside the existingFormat-JsonandImport-Jsonfunctions.Key Features
The
Export-Jsonfunction provides flexible JSON export capabilities with the following features:-InputObject) and JSON strings (-JsonString)Format-Jsonformatting options including spaces/tabs indentation, custom indentation sizes, and compact output-Forceparameter-WhatIf, various text encodings, and custom serialization depthUsage Examples
Integration with Existing Functions
The function integrates seamlessly with existing module functions:
Testing
Added comprehensive test coverage with 12 test cases covering:
Import-Jsonfor roundtrip validationAll tests pass, and the implementation follows the established patterns and conventions used by
Format-JsonandImport-Json.Fixes #3.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.