依赖
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.60</version>
</dependency>
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
//对象转json
JSON.toJSONString(alarmInfo)
//json转对象
AlarmInfo alarmInfo = JSONObject.parseObject(String.valueOf(stringRedisTemplate.opsForValue().get(key)), AlarmInfo.class);