You are viewing an older version of the site. Click here to view
the latest version of this page. (This may be a dead link, if so, try the root page of the docs
here.)
== json_decode ==
Copy Code
The output would be:
Takes a JSON encoded string, and returns an array, either normal or associative, depending on the contents of the JSON string. If the JSON string is improperly formatted, a FormatException is thrown.
=== Vital Info ===
{| style="width: 40%;" cellspacing="1" cellpadding="1" border="1" class="wikitable"
|-
! scope="col" width="20%" |
! scope="col" width="80%" |
|-
! scope="row" | Name
| json_decode
|-
! scope="row" | Returns
| array
|-
! scope="row" | Usages
| string
|-
! scope="row" | Throws
| [[../objects/ms.lang.FormatException|ms.lang.FormatException]]
|-
! scope="row" | Since
| 3.3.1
|-
! scope="row" | Restricted
| No
|-
! scope="row" | Optimizations
| None
|}
=== Usages ===
json_decode(string)=== Examples === ====Example 1==== Simple usage Given the following code:
json_decode("{\"one\": 1, \"two\": [1, 2, 3]}");

1 {{function|json_decode}}("{\"one\": 1, \"two\": [1, 2, 3]}");
NOWIKI
Find a bug in this page? Edit this page yourself, then submit a pull request. (Note this page is automatically generated from the documentation in the source code.)