change default behavior to toJSON2 for javascript functions