1.依赖导入
<!--hutool-->
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.7.17</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.66</version>
</dependency>
2.List转化为JSON
ArrayList<String> list= new ArrayList();
String Json = JSONUtil.toJsonStr(list);
stringRedisTemplate.opsForValue().set("list",Json );
3.JSON转换成List集合
String s= stringRedisTemplate.opsForValue().get("key");
List<类名> list = JSONObject.parseArray(s, 类名.class);
注:JSONObject采用fastjson工具包