JSON: Difference between revisions

735 bytes added ,  9 years ago
Line 2,174:
 
=={{header|PowerShell}}==
{{works with<lang PowerShell v3 and higher}}>
# JSON input is being stored in ordered hashtable.
<lang PowerShell>[ordered]@{ "foo"= 1; "bar"= 10, "apples" } | convertto-json</lang>
# Ordered hashtable is available in PowerShell v3 and higher.
<lang PowerShell>[ordered]@{ "foo"= 1; "bar"= 10, "apples" } | converttoConvertTo-json</lang>Json
 
# ConvertFrom-Json converts a JSON-formatted string to a custom object.
# If you use the Invoke-RestMethod cmdlet there is not need for the ConvertFrom-Json cmdlet
Invoke-WebRequest -Uri "http://date.jsontest.com" | ConvertFrom-Json
</lang>
{{out}}
<lang PowerShell>
{
"foo": 1,
Line 2,184 ⟶ 2,192:
]
}
 
time milliseconds_since_epoch date
---- ------------------------ ----
12:25:25 PM 1414326325923 10-26-2014
</lang>
 
=={{header|Python}}==
Anonymous user