This used to work for me but it no longer does. What's the new / better methodology for this?
$myObj = new stdClass();
$myObj->foo->bar = "content";
$payload = json_encode($myObj);
Now I get:
Uncaught Error: Attempt to modify property "bar" on null