{"id":1544,"date":"2014-04-23T00:01:00","date_gmt":"2014-04-23T00:01:00","guid":{"rendered":"https:\/\/blogs.technet.microsoft.com\/heyscriptingguy\/2014\/04\/23\/json-is-the-new-xml\/"},"modified":"2014-04-23T00:01:00","modified_gmt":"2014-04-23T00:01:00","slug":"json-is-the-new-xml","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/scripting\/json-is-the-new-xml\/","title":{"rendered":"JSON Is the New XML"},"content":{"rendered":"<p><b>Summary<\/b>: June Blender provides a primer about JSON.\nHonorary Scripting Guy, June Blender, here. Today I&#8217;m going to introduce you to JSON.<\/p>\n<p style=\"margin-left:30px\">June is a writer for the Azure Active Directory SDK. She is also a frequent contributor to the Hey, Scripting Guy! Blog and for PowerShell.org. She lives in magnificent Escalante, Utah, where she works remotely when she&#8217;s not out hiking, kayaking, or convincing lost tourists to try Windows PowerShell. She believes that outstanding documentation is a collaborative effort, and she welcomes your comments and contributions. Follow her on Twitter at&nbsp;<a href=\"https:\/\/twitter.com\/juneb_get_help\" target=\"_blank\">@juneb_get_help<\/a>.&nbsp;To read more by June, see these&nbsp;<a href=\"http:\/\/blogs.technet.com\/b\/heyscriptingguy\/archive\/tags\/june+blender\/\" target=\"_blank\">Hey, Scripting Guy! Blog posts<\/a>.&nbsp;\nI&#8217;ve been having a lot of fun learning web programming and working in Microsoft Azure and Azure PowerShell. I&#8217;ve noticed that I&#8217;m encountering a lot more JSON and a lot less XML over time. So, I thought I&#8217;d give our beginners a little primer on JSON.\nJavaScript Object Notation (JSON) is a &#8220;lightweight data-interchange format.&#8221; It is a way for programs to talk to each other, which is easy for humans to read and write, and easy for machines to parse and generate. It&#8217;s also really compressible. Unlike XML, which is wordy, you can squish JSON into a very few bytes so it&#8217;s small enough to include in fields with character limits, like the headers in the HTTP requests that web programs use to communicate.\nA JSON document is a string that looks like a hash table with name=value (or name:value) pairs, such as {&#8220;Color&#8221;=&#8221;Purple&#8221;} and&nbsp; {&#8220;State&#8221;:&#8221;Utah&#8221;}. It allows nesting, such as the &#8220;address&#8221; element this <a href=\"http:\/\/en.wikipedia.org\/wiki\/Json\" target=\"_blank\">Wikipedia<\/a> example:<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">{<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">&nbsp;&nbsp;&nbsp; &#8220;firstName&#8221;: &#8220;John&#8221;,<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">&nbsp;&nbsp;&nbsp; &#8220;lastName&#8221;: &#8220;Smith&#8221;,<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">&nbsp;&nbsp;&nbsp; &#8220;isAlive&#8221;: true,<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">&nbsp;&nbsp;&nbsp; &#8220;age&#8221;: 25,<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">&nbsp;&nbsp;&nbsp; &#8220;height_cm&#8221;: 167.64,<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">&nbsp;&nbsp;&nbsp; &#8220;address&#8221;: {<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8220;streetAddress&#8221;: &#8220;21 2nd Street&#8221;,<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8220;city&#8221;: &#8220;New York&#8221;,<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8220;state&#8221;: &#8220;NY&#8221;,<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8220;postalCode&#8221;: &#8220;10021-3100&#8221;<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">&nbsp;&nbsp;&nbsp; }<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">}\nJSON documents that are used for interprogram communication are based on a schema. The schemas are also written in JSON and are easy to interpret. You can use a JSON schema to determine how to write a JSON document, and then after writing, use it to validate a JSON document.\nFortunately, JSON is very easy to manage in Windows PowerShell. The <b>ConvertFrom-Json<\/b> cmdlet converts the JSON object into a custom object (PSCustomObject). JSON is case-sensitive, but the custom objects are case-insensitive.\nTo get a JSON string from a JSON file, use the <b>Get-Content<\/b> cmdlet with its <b>Raw<\/b> parameter.&nbsp;<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">PS C:&gt; Get-Content -Raw -Path .myJson.json<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">{<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">&nbsp;&nbsp;&nbsp; &#8220;firstName&#8221;: &#8220;John&#8221;,<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">&nbsp;&nbsp;&nbsp; &#8220;lastName&#8221;: &#8220;Smith&#8221;,<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">&nbsp;&nbsp;&nbsp; &#8220;isAlive&#8221;: true,<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">&nbsp;&nbsp;&nbsp; &#8220;age&#8221;: 25,<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">&nbsp;&nbsp;&nbsp; &#8220;height_cm&#8221;: 167.64,<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">&nbsp;&nbsp;&nbsp; &#8220;address&#8221;: {<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8220;streetAddress&#8221;: &#8220;21 2nd Street&#8221;,<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8220;city&#8221;: &#8220;New York&#8221;,<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8220;state&#8221;: &#8220;NY&#8221;,<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8220;postalCode&#8221;: &#8220;10021-3100&#8221;<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">&nbsp;&nbsp;&nbsp; }<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">}\nTo convert it to a custom object, pipe the JSON string to the <b>ConvertFrom-Json<\/b> cmdlet:<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">PS C:&gt; $j = Get-Content -Raw -Path .myJson.json | ConvertFrom-Json<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">PS C:&gt; $j<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">firstName : John<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">lastName&nbsp; : Smith<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">isAlive&nbsp;&nbsp; : True<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">age&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 25<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">height_cm : 167.64<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">address&nbsp;&nbsp; : @{streetAddress=21 2nd Street; city=New York; state=NY; postalCode=10021-3100}<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">PS C:&gt; $j.address<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">streetAddress&nbsp;&nbsp;&nbsp;&nbsp; city&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; state&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; postalCode<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">&#8212;&#8212;&#8212;&#8212;-&nbsp;&nbsp;&nbsp;&nbsp; &#8212;-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8212;&#8211;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8212;&#8212;&#8212;-<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">21 2nd Street&nbsp;&nbsp;&nbsp;&nbsp; New York&nbsp;&nbsp; NY&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;10021-3100\nThe <b>Raw<\/b> parameter tells <b>Get-Content<\/b> to ignore line breaks and return a single string. You can tell how many strings you have by counting the number of objects that are returned. Without <b>Raw<\/b>, you get 13 separate strings. With <b>Raw<\/b>, you get a single string.<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">PS C:&gt; (Get-Content -Path .myJson.json).count<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">13<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">PS C:&gt; (Get-Content -Path .myJson.json -Raw).count<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">1\nIf you forget the <b>Raw<\/b> parameter and pipe multiple strings to<b> ConvertFrom-Json<\/b>, you get this distinctive error message, which is Pig Latin for &#8220;Did you forget the <b>Raw<\/b> parameter?&#8221;<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">ConvertFrom-Json : Invalid object passed in, &#8216;:&#8217; or &#8216;}&#8217; expected. (1): {<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">At line:1 char:20<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">+ cat .myJson.json | ConvertFrom-Json<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ~~~~~~~~~~~~~~~~<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">&nbsp;&nbsp;&nbsp; + CategoryInfo&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : NotSpecified: (:) [ConvertFrom-Json], ArgumentException<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">&nbsp;&nbsp;&nbsp; + FullyQualifiedErrorId : System.ArgumentException,Microsoft.PowerShell.Commands.ConvertFromJsonCommand\nThe <b>ConvertFrom-Json<\/b> cmdlet converts each JSON string into a custom object. It converts each name-value pair into a <b>note property<\/b> and its value.<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">PS C:&gt; $j = Get-Content -Raw -Path .myJson.json | ConvertFrom-Json<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">PS C:&gt; $j | Get-Member<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">&nbsp;&nbsp; TypeName: System.Management.Automation.PSCustomObject<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">Name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MemberType&nbsp;&nbsp; Definition<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">&#8212;-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8212;&#8212;&#8212;-&nbsp;&nbsp; &#8212;&#8212;&#8212;-<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">Equals&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Method&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bool Equals(System.Object obj)<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">GetHashCode Method&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int GetHashCode()<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">GetType&nbsp;&nbsp;&nbsp;&nbsp; Method&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; type GetType()<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">ToString&nbsp;&nbsp;&nbsp; Method&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; string ToString()<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">address&nbsp;&nbsp;&nbsp;&nbsp; NoteProperty System.Management.Automation.PSCustomObject<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">age&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NoteProperty System.Int32 age=25<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">firstName&nbsp;&nbsp; NoteProperty System.String firstName=John<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">height_cm&nbsp;&nbsp; NoteProperty System.Decimal height_cm=167.64<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">isAlive&nbsp;&nbsp;&nbsp;&nbsp; NoteProperty System.Boolean isAlive=True<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">lastName&nbsp;&nbsp;&nbsp; NoteProperty System.String lastName=Smith<\/p>\n<p style=\"margin-left:30px\">For example, it converts this:<\/p>\n<p style=\"margin-left:60px\">&#8220;firstName&#8221;: &#8220;John&#8221;\n&hellip;into a <b>firstName<\/b> note property with a value of <b>John<\/b>:<\/p>\n<p class=\"Code\" style=\"margin-left:60px\">PS C:&gt; $j.firstName<\/p>\n<p class=\"Code\" style=\"margin-left:60px\">John\nWhen it encounters a nested JSON object, like the one in the value of <b>address<\/b>, it converts the value into a nested custom object with note properties representing each name-value pair.\nFor example, it converts this:<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">&#8220;address&#8221;:&nbsp; {<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8220;streetAddress&#8221;:&nbsp; &#8220;21 2nd Street&#8221;,<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8220;city&#8221;:&nbsp; &#8220;New York&#8221;,<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8220;state&#8221;:&nbsp; &#8220;NY&#8221;,<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8220;postalCode&#8221;:&nbsp; &#8220;10021-3100&#8221;<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }\nTo:<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">PS C:&gt; $j.address<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">streetAddress&nbsp;&nbsp;&nbsp;&nbsp; city&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; state&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; postalCode<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">&#8212;&#8212;&#8212;&#8212;-&nbsp;&nbsp;&nbsp;&nbsp; &#8212;-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8212;&#8211;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8212;&#8212;&#8212;-<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">21 2nd Street&nbsp;&nbsp;&nbsp;&nbsp; New York&nbsp;&nbsp; NY&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 10021-3100\n&hellip;which is a custom object with its own note properties:<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">PS C:&gt; $j.address | Get-Member<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">&nbsp;&nbsp; TypeName: System.Management.Automation.PSCustomObject<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">Name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MemberType&nbsp;&nbsp; Definition<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">&#8212;-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8212;&#8212;&#8212;- &nbsp;&nbsp;&#8212;&#8212;&#8212;-<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">Equals&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Method&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bool Equals(System.Object obj)<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">GetHashCode&nbsp;&nbsp; Method&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int GetHashCode()<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">GetType&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Method&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; type GetType()<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">ToString&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Method&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; string ToString()<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">city&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NoteProperty System.String city=New York<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">postalCode&nbsp;&nbsp;&nbsp; NoteProperty System.String postalCode=10021-3100<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">state&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NoteProperty System.String state=NY<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">streetAddress NoteProperty System.String streetAddress=21 2nd Street<\/p>\n<p style=\"margin-left:30px\">You can edit the custom object and then use the<b> ConvertTo-Json<\/b> cmdlet and <b>Set-Content<\/b> cmdlets to replace the value in the .json file. Let&#8217;s move John Smith to a more scenic location:<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">$j.address.city = &#8220;Escalante&#8221;<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">$j.address.state = &#8220;UT&#8221;<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">$j.address.postalCode = &#8220;84726&#8221;\n&nbsp;<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">PS C:&gt; $j<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">firstName : John<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">lastName&nbsp; : Smith<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">isAlive&nbsp; &nbsp;: True<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">age&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 25<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">height_cm : 167.64<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">address&nbsp;&nbsp; : @{streetAddress=21 2nd Street; city=Escalante; state=UT; postalCode=84726}\nNow, convert the custom object back to JSON&#8230;<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">PS C:&gt; $j | ConvertTo-Json<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">{<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">&nbsp;&nbsp;&nbsp; &#8220;firstName&#8221;:&nbsp; &#8220;John&#8221;,<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">&nbsp;&nbsp;&nbsp; &#8220;lastName&#8221;:&nbsp; &#8220;Smith&#8221;,<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">&nbsp;&nbsp;&nbsp; &#8220;isAlive&#8221;:&nbsp; true,<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">&nbsp;&nbsp;&nbsp; &#8220;age&#8221;:&nbsp; 25,<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">&nbsp;&nbsp;&nbsp; &#8220;height_cm&#8221;:&nbsp; 167.64,<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">&nbsp;&nbsp;&nbsp; &#8220;address&#8221;:&nbsp; {<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8220;streetAddress&#8221;:&nbsp; &#8220;21 2nd Street&#8221;,<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8220;city&#8221;:&nbsp; &#8220;Escalante&#8221;,<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8220;state&#8221;:&nbsp; &#8220;UT&#8221;,<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8220;postalCode&#8221;:&nbsp; &#8220;84726&#8221;<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">}\n&hellip;and replace the content in the myJson.json file:<\/p>\n<p class=\"Code\" style=\"margin-left:30px\">PS C:&gt; $j | ConvertTo-Json | Set-Content -Path .myJson.json\nNow you&#8217;re ready to work with more complex JSON strings, such as the new Azure Gallery templates. More on that subject in another post.\nI invite you to follow the Scripting Guys on&nbsp;<a href=\"http:\/\/bit.ly\/scriptingguystwitter\" target=\"_blank\">Twitter<\/a>&nbsp;and&nbsp;<a href=\"http:\/\/bit.ly\/scriptingguysfacebook\" target=\"_blank\">Facebook<\/a>. If you have any questions, send email to <a href=\"http:\/\/blogs.technet.commailto:scripter@microsoft.com\" target=\"_blank\">scripter@microsoft.com<\/a>, or post your questions on the&nbsp;<a href=\"http:\/\/bit.ly\/scriptingforum\" target=\"_blank\">Official Scripting Guys Forum<\/a>.&nbsp;\n<b>June Blender, <\/b>senior programming writer and&nbsp;Microsoft Scripting Guy<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Summary: June Blender provides a primer about JSON. Honorary Scripting Guy, June Blender, here. Today I&#8217;m going to introduce you to JSON. June is a writer for the Azure Active Directory SDK. She is also a frequent contributor to the Hey, Scripting Guy! Blog and for PowerShell.org. She lives in magnificent Escalante, Utah, where she [&hellip;]<\/p>\n","protected":false},"author":596,"featured_media":87096,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[56,370,3,45],"class_list":["post-1544","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-scripting","tag-guest-blogger","tag-june-blender","tag-scripting-guy","tag-windows-powershell"],"acf":[],"blog_post_summary":"<p>Summary: June Blender provides a primer about JSON. Honorary Scripting Guy, June Blender, here. Today I&#8217;m going to introduce you to JSON. June is a writer for the Azure Active Directory SDK. She is also a frequent contributor to the Hey, Scripting Guy! Blog and for PowerShell.org. She lives in magnificent Escalante, Utah, where she [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/1544","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/users\/596"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/comments?post=1544"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/1544\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media\/87096"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media?parent=1544"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/categories?post=1544"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/tags?post=1544"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}