package com.wecloud.im.sdk.internal;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;
import com.wecloud.im.sdk.common.ApiResult;

/**
 *
 * @Author luozh
 * @Date 2022年04月15日 20:40
 * @Version 1.0
 */
public class ResponseParser {

    /**
     * Converts the result from stream to a java object.
     *
     * @param jsonResult
     */
    public static Object parse(String jsonResult) {
        TypeReference<ApiResult<Object>> typeRef = new TypeReference<ApiResult<Object>>() {
        };
        ApiResult<Object> apiResult = (ApiResult<Object>) JSON.parseObject(jsonResult, typeRef);
        return apiResult.getData();
    }
}
