crap!! the problem was that I was putting echo in front of it when it was an object
echo $userinfo = json_decode($userinfo);
but this works when it's an array.. like
echo $userinfo = json_decode($userinfo, true);
it prints Array..
It would be great if the first one printed object or something instead of breaking down..