add helper function to convert raw v8 object to cpgf