A rule of thumb should be I need to be able to read from the function name what it does (maybe too optimistic but). Anyway, if you end up naming your function LookupVarRefAndConvertToJson, then the name itself should be a sign that something could probably be split.