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);
Answer from Stephen on Stack Overflow
🌐
PHP
php.net › manual › en › function.json-decode.php
PHP: json_decode - Manual
JSON can be decoded to PHP arrays by using the $associative = true option. Be wary that associative arrays in PHP can be a "list" or "object" when converted to/from JSON, depending on the keys (of absence of them).
🌐
W3Schools
w3schools.com › php › func_json_decode.asp
PHP json_decode() Function
The json_decode() function is used to decode or convert a JSON object to a PHP object.
🌐
W3Docs
w3docs.com › php
How to JSON Decode a String into an Array with PHP
This is a short guideline that provides comprehensive information on how to decode a JSON string into an array with the help of PHP.
🌐
Tutorial Republic
tutorialrepublic.com › php-tutorial › php-json-parsing.php
How to Encode and Decode JSON Data in PHP - Tutorial Republic
JSON data structures are very similar to PHP arrays. PHP has built-in functions to encode and decode JSON data. These functions are json_encode() and json_decode(), respectively.
🌐
PHPpot
phppot.com › php › php-object-to-array
PHP Object to Array Convert using JSON Decode - PHPpot
This quick example performs a PHP object to array conversion in a single step. It creates an object bundle and sets the properties. It uses JSON encode() decode() function for the conversion.
Find elsewhere
🌐
Jobtensor
jobtensor.com › Tutorial › PHP › en › JSON
PHP JSON - json_encode(), json_decode() | jobtensor
<?php $countries = array("Mark" => "USA", "Raymond" => "UK", "Jeff" => "JPN", "Mike" => "DE"); echo json_encode($countries); The json_decode() function is used to decode a JSON object into a PHP associative array or object.
🌐
Jonathan Suh
jonsuh.com › blog › convert-loop-through-json-php-javascript-arrays-objects
Convert and Loop through JSON with PHP and JavaScript Arrays/Objects — Jonathan Suh
September 30, 2014 - <?php // JSON string $someJSON = '[{"name":"Jonathan Suh","gender":"male"},{"name":"William Philbin","gender":"male"},{"name":"Allison McKinnery","gender":"female"}]'; // Convert JSON string to Array $someArray = json_decode($someJSON, true); print_r($someArray); // Dump all data of the Array echo $someArray[0]["name"]; // Access Array data // Convert JSON string to Object $someObject = json_decode($someJSON); print_r($someObject); // Dump all data of the Object echo $someObject[0]->name; // Access Object data ?>
🌐
Reintech
reintech.io › blog › php-json-encoding-decoding-web-services
PHP and JSON: Encoding, Decoding, and Web Services | Reintech media
April 28, 2023 - Always validate decoded JSON data before using it in your application: function parseUserData(string $json): ?array { try { $data = json_decode($json, true, 512, JSON_THROW_ON_ERROR); // Validate required fields $required = ['name', 'email', 'age']; foreach ($required as $field) { if (!isset($data[$field])) { throw new InvalidArgumentException("Missing required field: {$field}"); } } // Validate data types if (!is_string($data['name']) || strlen($data['name']) === 0) { throw new InvalidArgumentException("Invalid name"); } if (!filter_var($data['email'], FILTER_VALIDATE_EMAIL)) { throw new InvalidArgumentException("Invalid email format"); } if (!is_int($data['age']) || $data['age'] < 0) { throw new InvalidArgumentException("Invalid age"); } return $data; } catch (JsonException $e) { error_log("JSON parsing error: " .
🌐
ReqBin
reqbin.com › code › php › 0uwqq41y › json-to-array-php-example
How do I convert JSON to PHP array?
To convert a JSON data string to a PHP array, you can use the json_decode($json) function. The json_decode() function accepts the JSON string as the first parameter and a few additional parameters to control the process of converting JSON to ...
🌐
Netlify
json2php.netlify.app
JSON to PHP - json_decode online
We're sorry but JSON to PHP doesn't work properly without JavaScript enabled. Please enable it to continue
🌐
Edureka Community
edureka.co › home › community › categories › web development › php › json decode to array
json decode to array | Edureka Community
June 2, 2022 - I want to decode a JSON string into an array but I am getting this error. Fatal error: Cannot use ... Result']); ?> Can someone help me fix this?
🌐
Medium
medium.com › @jochelle.mendonca › demystifying-json-and-arrays-in-php-unraveling-the-complexity-c8a1c9d51896
Demystifying JSON and Arrays in PHP: Unraveling the Complexity | Medium
March 6, 2024 - Let’s walk through the nuances of working with PHP arrays and JSON, showing how easily to encode and decode JSON data.
🌐
ReqBin
reqbin.com › code › php › zg4d50d8 › php-json-decode-example
How do I decode JSON in PHP?
July 7, 2023 - To decode a JSON string or file in PHP, you can use the json_decode($json, $assoc, $depth, $options) function. The first parameter specifies the string to be decoded. The second optional parameter sets whether the returned object should be converted ...
🌐
GitHub
github.com › phpstan › phpstan › discussions › 6820
json_decode (associative) but not an array · phpstan/phpstan · Discussion #6820
Only after writing a feature-request for this, I noticed the bug (in my code): json_decode only returns an array, if it was a valid JSON object to begin with.
Author   phpstan