js functions for converting data representations