new function to turn js object literals into json, use it in gcalc