messing with some json encoding stuff.  this will be painful :(