I was using
mcrypt to encrypt
On other side, mycrypt was able to decrpyt data but
json_decode was not working. It would throw
However, without mcrypt, json_decode worked flawlessly.
After some trial and error, I found that applying
trim function after decrypting data would let me use json_decode without any issues.