Persist a value on disk as JSON (for command-line tools etc).