JSON 101 for IT Administrators

Azure Resource Manager (ARM) templates are written in JSON or JavaScript Object Notation. To understand ARM templates, you need to understand few quick basics about JSON. These will enable you to lay a great foundation which will enable you to understand ARM templates very easily.

JSON or JavaScript Object Notation (pronounce like “Jay-son”) is a text-based data format that’s designed to be human-readable, lightweight, and easy to transmit between a server and a web client. Its syntax is derived from JavaScript. Think of this as an even more compact version of XML files.

JSON is a popular notation for transmitting data through RESTful web services. The official internet media type for JSON is application/json, and JSON files typically have a .json extension.

To understand JSON we need to understand 3 main components. These components are like building blocks, using which you can build very complex JSON files.

1. Objects

Objects are the heart of JSON. Object denotes a real life object, e.g. an Employee. Just like a real life object, these have various properties and a value for each of these properties. E.g. An Employee will have Name property with value as John. Further, an employee object can have various another properties like Age, Salary, Department etc. So to denote an object in JSON you:

  • One object will be represented by curly brackets. It will begin from opening curly bracket i.e. { and will end at closing curly bracket i.e. }
  • Denote the property and corresponding values as "key" : "value" or "property" : "value" pairs.
  • You can only use double quotes for Properties as they will always be of type string
  • You will have double quotes around Values if they are of string type. You will not have any quotes in case of a number or a boolean value.
  • Each property will be separated from next property by a comma

Note: Each JSON file is also a single JSON object. At root level it starts with an opening curly bracket i.e. { and will end with closing curly bracket i.e. }. There can’t be any other objects at the root level. Think of this similar to how in an XML file there can be only one element at the root level.

View the full post here

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.