I encountered the same error, but the difference was that when I ran php -m the json module was not listed, so I just installed json PHP module using the command below:
sudo yum install php-json
the error was fixed and I was able to install composer. I was using CentOS 8 stream, PHP7.2.