Add builtin function ‘fromJSON’

Fixes #294.