GithubHelp home page GithubHelp logo

cymadigan / convertto-pson Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dpassarelli/convertto-pson

0.0 1.0 0.0 12 KB

Converts a PS Hashtable object to a PSON-formatted string.

License: MIT License

PowerShell 100.00%

convertto-pson's Introduction

ConvertTo-PSON

Converts a PowerShell Hashtable object to a PSON-formatted string.

Usage

  1. Download the source code.
  2. Dot-source ConvertTo-PSON.ps1 in your script.
  3. Call ConvertTo-PSON, providing a Hashtable object as the only parameter, and assign the resulting value to a String variable.

Limitations

This function currently only understands the following general types of data:

  • strings
  • integers
  • decimals
  • date/time
  • booleans
  • $null
  • Hashtables

It does not yet understand arrays, nor other specific object types (such as PSCustomObject, or Credential, etc).

I've only confirmed that this code works with PowerShell 5 running on .NET Core 2. Additional versions will be tested as soon as I bring this project into a cloud-based CI system.

Why?

I needed this for some TDD that I was doing in PowerShell. If you haven't already, check out Pester!

And if you aren't testing, then get onboard already! Just remember that it's not magic.

Inspiration

https://stackoverflow.com/q/15139552

License

MIT (please refer to the file named LICENSE).

convertto-pson's People

Contributors

dpassarelli avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.