/**
  * Builds the JSON format response string.
  *
  * @return the JSON format response string
  * @throws JSONException if error occurs when building the JSONObject
  */
 public String build() throws JSONException {
   JSONObject result = new JSONObject();
   Iterator<JsonField> iterator = values.keySet().iterator();
   while (iterator.hasNext()) {
     JsonField key = iterator.next();
     Object value = values.get(key);
     if (value != null) {
       switch (key) {
         case STATUS:
           {
             Status status = (Status) value;
             result.put("status", status.toJsonString());
             break;
           }
         case IDP:
           {
             result.put("idp", value);
             break;
           }
         case DISPLAY_NAME:
           {
             result.put("displayName", value);
             break;
           }
         case PHOTO_URL:
           {
             result.put("photoUrl", value);
             break;
           }
       }
     }
   }
   return result.toString();
 }