package com.wecloud.im.sdk.internal;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
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 JSONObject parse(String jsonResult) {
        TypeReference typeRef = new TypeReference<ApiResult<JSONObject>>() {
        };
        ApiResult<JSONObject> apiResult = (ApiResult<JSONObject>) JSON.parseObject(jsonResult, typeRef);
        return apiResult.getData();
    }
}
