Added to_json functionality