📜  清洁 facebook graphql 响应 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:45.141000             🧑  作者: Mango

代码示例1
cleanGraphQl(body) {
        // Response contains two json objects, we want the first one only
        const pos = body.lastIndexOf('{');
        body = body.slice(0, pos - 1);

        try {
            return JSON.parse(body);
        } catch (e) {
            return {};
        }
    }