replace readfile with a sandbox version
add jsonfile() template function