added json() returned error msgs for functions