Renamed msg2json to parseKeyValueMessage and moved it inline with other static functions