return error on invalid chars in json strings