Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

clean facebook graphql response

 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 {};
        }
    }
Source by github.com #
 
PREVIOUS NEXT
Tagged: #clean #facebook #graphql #response
ADD COMMENT
Topic
Name
8+9 =