move to_string and to_json functions into Token struct