string handling for json formatting, fixes Pinoccio/server-carlo#43