package io.geekidea.springbootplus.test;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.wecloud.im.ws.model.request.ReceiveVO;
import com.wecloud.utils.JsonUtils;

public class JsonTest {

    public static void main(String[] args) {

//        jsonTest();
    }

    private static void jsonTest() {
        String data = "{\n" +
                "\"reqId\":\"123123\",\n" +
                "\"cmd\":1,\n" +
                "\"data\":{\n" +
                "    \"type\":-1,\n" +
                "    \"text\":\"这是一个纯文本消息\",\n" +
                "    \"attrs\":{\n" +
                "    \"a\":\"attrs是用来存储用户自定义的一些键值对\"}}\n" +
                "}\n";

        // json转换成对象
        ReceiveVO receiveVO = JsonUtils.decodeJson(data, ReceiveVO.class);

        // data对象转换成json
        JsonUtils.encodeJson(receiveVO.getData());
    }


}
