Working with ConvertTo-Json output issues

As you are aware, we can use ConvertTo-Json cmdlet to convert an object to Json output format using PowerShell. However, there is something you need to be aware of while using conversion. By default, it does not work with very large objects (containing of multiple sub-objects) and converts them properly. This is because of the fact that the Depth parameter for ConvertTo-Json has a default value of 2. Let’s understand what this means.

For our example, we’ll create a JSON file with below details first and save it on to your local machine as new-json.json

Continue reading “Working with ConvertTo-Json output issues”

Working with JSON in PowerShell

In last post, we have described on what JSON is and how it is becoming increasingly important in the DevOps phenomenon. So its necessarily not only to understand the format, but also involve in our tools of choices. Microsoft has introduced couple of cmdlets in PowerShell to make use of JSON format namely ConvertFrom-JSON and ConvertTo-JSON.

Again, we can get the same by making use of Get-Command cmdlet:

JSON cmdlets in PowerShell
JSON cmdlets in PowerShell

Continue reading “Working with JSON in PowerShell”

Understanding JSON and compare it to XML

In this day and age of continuous delivery and integration, the focus is continuously moving away from software interface and on to APIs. One of the prime objectives of DevOps is to achieve end to end automation of delivery. For this, the various kinds of softwares which are used in the process of delivery, need to exchange data. This is where APIs come in handy. Using APIs, there is no manual intervention needed, and all the data can be exchanged easily.

APIs, more specifically REST APIs, return data when queried. The earlier format of choice used to be XML, then it turned over to XAML but now the focus is on JSON due to its easiness.¬† Continue reading “Understanding JSON and compare it to XML”