using json library to make output a valid json string