implement tojson for socket communication, underscore upgrade