Fix JSON builder expecting String where it now receives StringIO

Fix for #179