How can the code provided be modified to avoid the need for square brackets when decoding JSON data in PHP?

When decoding JSON data in PHP using `json_decode()`, the default behavior is to return an associative array. To avoid the need for square brackets when accessing the decoded JSON data, you can set the second parameter of `json_decode()` to `true` to return an array instead of an object.

// JSON data to be decoded
$json_data = '{"name": "John", "age": 30}';

// Decode JSON data as an associative array
$decoded_data = json_decode($json_data, true);

// Access decoded data without using square brackets
echo $decoded_data['name']; // Output: John
echo $decoded_data['age']; // Output: 30