Answer with Homebrew
realpath
is the best answer, but if you don't have it installed, you must first run brew install coreutils
which will install coreutils with lots of awesome functions. Writing a custom function and exporting it is too much work and risk for error for something like this, here are two lines:
$ brew install coreutils$ realpath your-file-name.json