simplified the to_json functionality