we are a community of more than 2 million smartest coders
registration for
employee referral programs
are now open
get referred to google, amazon, flipkart and more
register now
  
pinned-register now
showing results for - "clean facebook graphql response"
Alan
09 Aug 2016
1 cleanGraphQl(body) {
2        // Response contains two json objects, we want the first one only
3        const pos = body.lastIndexOf('{');
4        body = body.slice(0, pos - 1);
5
6        try {
7            return JSON.parse(body);
8        } catch (e) {
9            return {};
10        }
11    }