/**
  * Serializa el bean en formato JSON
  *
  * @throws es.tid.serial.json.JSONException Cuando se produce una excepción al serializar el bean
  * @return Cadena de texto en formato JSON
  */
 public String toJSON(boolean prettyPrint) throws JSONException {
   JSONObject json = new JSONObject();
   this.toJSON(json);
   if (prettyPrint) {
     return json.toString(4);
   } else {
     return json.toString();
   }
 }