PHP
php.net โบ manual โบ en โบ function.json-decode.php
PHP: json_decode - Manual
You would expect that recoding and re-encoding will always yield the same JSON string, but take this example: $json = '{"0": "No", "1": "Yes"}'; $array = json_decode($json, true); // decode as associative hash print json_encode($array) .
W3Schools
w3schools.com โบ php โบ func_json_decode.asp
PHP json_decode() Function
$jsonobj = '{"Peter":35,"Ben":37,"Joe":43}'; $obj = json_decode($jsonobj); echo $obj->Peter; echo $obj->Ben; echo $obj->Joe; Run Example ยป
Videos
06:27
How to Parse JSON Data in JavaScript | Learn JSON.parse() to Read ...
06:25
How to Parse JSON Data in JavaScript | Convert JSON Strings to ...
2 The Basics of JSON Decoding - Swift
12:20
Parse JSON in PHP | How to validate and process nested JSON data ...
09:50
Terraform and JSON - The jsonencode and jsondecode functions in ...
07:02
How to encode and decode JSON data using PHP | PHP and JSON Tutorial.
OnlinePHP
onlinephp.io โบ json-decode โบ examples
json_decode - Examples
Examples of json_decode. Info and examples on json_decode PHP Function
Flutter
api.flutter.dev โบ flutter โบ dart-convert โบ jsonDecode.html
jsonDecode function - dart:convert library - Dart API
const jsonString = '{"text": "foo", "value": 1, "status": false, "extra": null}'; final data = jsonDecode(jsonString); print(data['text']); // foo print(data['value']); // 1 print(data['status']); // false print(data['extra']); // null const jsonArray = ''' [{"text": "foo", "value": 1, "status": true}, {"text": "bar", "value": 2, "status": false}] '''; final List<dynamic> dataList = jsonDecode(jsonArray); print(dataList[0]); // {text: foo, value: 1, status: true} print(dataList[1]); // {text: bar, value: 2, status: false} final item = dataList[0]; print(item['text']); // foo print(item['value']); // 1 print(item['status']); // false
Elm
package.elm-lang.org โบ packages โบ elm โบ json โบ latest โบ Json.Decode
Json.Decode - json 1.1.4
We cannot provide a description for this page right now
Tutorialspoint
tutorialspoint.com โบ php โบ php_function_javascript_object_notation_json_decode.htm
PHP - json_decode() Function
<?php // Assign a JSON object to a variable $someJSON = '{"name" : "Raja", "Adithya" : "Jai"}'; // Convert the JSON to an associative array $someArray = json_decode($someJSON, true); // Read the elements of the associative array foreach($someArray ...
MDN Web Docs
developer.mozilla.org โบ en-US โบ docs โบ Web โบ JavaScript โบ Reference โบ Global_Objects โบ JSON โบ parse
JSON.parse() - JavaScript - MDN Web Docs
Because JSON has no syntax space for annotating type metadata, in order to revive values that are not plain objects, you have to consider one of the following: Serialize the entire object to a string and prefix it with a type tag. "Guess" based on the structure of the data (for example, an ...
JSON Formatter
jsonformatter.org
Best JSON Formatter and JSON Validator: Online JSON Formatter
Online JSON Formatter / Beautifier and JSON Validator will format JSON data, and helps to validate, convert JSON to XML, JSON to CSV. Save and Share JSON
ReqBin
reqbin.com โบ code โบ php โบ zg4d50d8 โบ php-json-decode-example
How do I decode JSON in PHP?
July 7, 2023 - If the JSON cannot be decoded or the nesting depth of the data is greater than the recursion limit, the decode function will return NULL. To encode PHP objects to JSON, you can use the json_encode($value) function. In this PHP Decode JSON example, we use the json_decode() function to convert ...
Top answer 1 of 12
983
As per the documentation, you need to specify true as the second argument if you want an associative array instead of an object from json_decode. This would be the code:
$result = json_decode($jsondata, true);
If you want integer keys instead of whatever the property names are:
$result = array_values(json_decode($jsondata, true));
However, with your current decode you just access it as an object:
print_r($obj->Result);
2 of 12
50
try this
$json_string = 'http://www.domain.com/jsondata.json';
$jsondata = file_get_contents($json_string);
$obj = json_decode($jsondata,true);
echo "<pre>";
print_r($obj);
Jobtensor
jobtensor.com โบ Tutorial โบ PHP โบ en โบ JSON
PHP JSON - json_encode(), json_decode() | jobtensor
Decode the following JSON object and print the data in the format: Name - Country.
Tutorial Republic
tutorialrepublic.com โบ php-tutorial โบ php-json-parsing.php
How to Encode and Decode JSON Data in PHP - Tutorial Republic
These functions are json_encode() and json_decode(), respectively. Both functions only works with UTF-8 encoded string data. In PHP the json_encode() function is used to encode a value to JSON format. The value being encoded can be any PHP data type except a resource, like a database or file handle. The below example demonstrates how to encode a PHP associative array into a JSON object:
FlatCoding
flatcoding.com โบ home โบ php json handling with json_encode & json_decode
PHP JSON Handling with json_encode & json_decode - FlatCoding
April 15, 2025 - If you prefer to work with objects rather than arrays, just omit the true parameter, and json_decode() will return a PHP object: Here is another example of decoding JSON to an object:
BitDegree
bitdegree.org โบ learn โบ best-code-editor โบ php-json-decode-example-8
PHP json_decode: Example of Using the HTTP POST method
obj = { "table":"customers", "limit":10 }; dbParam = JSON.stringify(obj); xmlhttp = new XMLHttpRequest(); xmlhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { newObj = JSON.parse(this.responseText); for (x in newObj) { txt += newObj[x].name + "<br>"; } document.getElementById("JSON").innerHTML = txt; } }; xmlhttp.open("POST", "JSON.php", true); xmlhttp.setRequestHeader("Content-type", "application/learn-encoded"); xmlhttp.send("x=" + dbParam);
Lianja
lianja.com โบ doc โบ index.php โบ JSON_DECODE()
JSON DECODE() - Lianjapedia
myobj = json_decode('{"Name":"Barry", "Company":"Lianja", "Items":["One", "two"]}') ? myobj ? myobj.name ? myobj.company ? myobj.items[1] ?