Examples of JsonConfig


Examples of net.sf.json.JsonConfig

        String jsonString;

        if (data == null) {
            jsonString = "{}";
        } else {
            JsonConfig jsonConfig = new JsonConfig();
            jsonConfig.setExcludes(excludes);
            jsonConfig.setCycleDetectionStrategy(CycleDetectionStrategy.LENIENT);
            Object jsObj = JSONSerializer.toJSON(data,jsonConfig);
            jsonString = jsObj.toString();
        }

        try {
View Full Code Here

Examples of net.sf.json.JsonConfig

    public static String toJson(Object obj) {
        return toJson(obj,null);
    }
   
    public static String toJson(Object obj, String[] excludes) {
        JsonConfig c = new JsonConfig();
        if (excludes != null) {
            c.setExcludes(excludes);
        }
        c.setCycleDetectionStrategy(CycleDetectionStrategy.LENIENT);
        Object jsObj = JSONSerializer.toJSON(obj, c);
       
        String result = jsObj.toString();
       
View Full Code Here

Examples of net.sf.json.JsonConfig

        String jsonString;

        if (data == null) {
            jsonString = "{}";
        } else {
            JsonConfig jsonConfig = new JsonConfig();
            jsonConfig.setExcludes(excludes);
            jsonConfig.setCycleDetectionStrategy(CycleDetectionStrategy.LENIENT);
            jsonConfig.setJsonPropertyFilter(ignoreNullFilter);
            Object jsObj = JSONSerializer.toJSON(data,jsonConfig);
            jsonString = jsObj.toString();
        }

        try {
View Full Code Here

Examples of net.sf.json.JsonConfig

      return ERXRestUtils.coerceValueToString(obj, _context);
    }
  }

  public static JsonConfig createDefaultConfig(ERXRestContext context) {
    JsonConfig config = new JsonConfig();
    config.registerJsonValueProcessor(NSTimestamp.class, new GeneralObjectToStringProcessor(context));
    config.registerJsonValueProcessor(LocalDate.class, new GeneralObjectToStringProcessor(context));
    config.registerJsonValueProcessor(LocalDateTime.class, new GeneralObjectToStringProcessor(context));
    config.registerJsonValueProcessor(Date.class, new GeneralObjectToStringProcessor(context));
    config.registerJsonValueProcessor(NSData.class, new GeneralObjectToStringProcessor(context));
    config.registerJsonValueProcessor(ERXCryptoString.class, new GeneralObjectToStringProcessor(context));
    config.setJsonValueProcessorMatcher(new ERXRestValueProcessorMatcher());
    return config;
  }
View Full Code Here

Examples of net.sf.json.JsonConfig

    /**
     * @param _for
     *      Account for which the virtual machine is assigned to.
     */
    public VirtualMachineRef createVirtualMachine(HardwareSpec spec, String _for) throws IOException {
        JsonConfig jsc = new JsonConfig();
        jsc.setIgnoreTransientFields(true);

        String q = _for != null ? "?for=" + _for : "";
        HttpURLConnection con = postJson(open("createVirtualMachine" + q), JSONObject.fromObject(spec,jsc));
        verifyResponseStatus(con);
        return new VirtualMachineRef(new URL(con.getHeaderField("Location")), token);
View Full Code Here

Examples of net.sf.json.JsonConfig

      return;

    ItineraryV2Bean bean = new ItineraryV2Bean();
    JSONObject jsonObject = JSONObject.fromObject(includeSelectedItinerary);

    JsonConfig config = new JsonConfig();

    Map<Object, Object> classMap = new HashMap<Object, Object>();
    classMap.put("legs", LegV2Bean.class);
    classMap.put("streetLegs", StreetLegV2Bean.class);
    classMap.put("situationIds", String.class);
    config.setClassMap(classMap);

    JSONObject.toBean(jsonObject, bean, config);

    ItineraryBean itinerary = itineraryFactory.reverseItinerary(bean);
    constraints.setSelectedItinerary(itinerary);
View Full Code Here

Examples of net.sf.json.JsonConfig

      sb.append(buffer, 0, len);
    }
    if (target != null && sb.length() > 0 && sb.charAt(0) == '[') {
      JSONArray jsonArray = JSONArray.fromObject(sb.toString());
      if (target.getClass().isArray()) {
        JSONArray.toArray(jsonArray, target, new JsonConfig());
      } else {
        JSONArray.toList(jsonArray, target, new JsonConfig());
      }

    } else {
      JSONObject jsonObject = JSONObject.fromObject(sb.toString());
      JSONObject.toBean(jsonObject, target, new JsonConfig());
    }
  }
View Full Code Here

Examples of net.sf.json.JsonConfig

    return WebUtils.toString(bandInfo);
  }
 
  public JsonUtils()
  {
    jsonConfig = new JsonConfig();

    jsonConfig.registerJsonValueProcessor(DateTime.class,
        new JsonValueProcessor() {
          public Object processArrayValue(Object arg0, JsonConfig arg1) {
            throw new UnsupportedOperationException();
View Full Code Here

Examples of net.sf.json.JsonConfig

    return WebUtils.toString(bandInfo);
  }

  public JsonUtils()
  {
    jsonConfig = new JsonConfig();

    jsonConfig.registerJsonValueProcessor(DateTime.class, new JsonValueProcessor()
    {
      public Object processArrayValue(Object arg0, JsonConfig arg1)
      {
View Full Code Here

Examples of net.sf.json.JsonConfig

   
    scriptVO.setAllowedTemplates(allowedTemplateIdsList);
    scriptVO.setActionIds(actionIdsList);
    scriptVO.setStatIds(statIdsList);
   
    JsonConfig config = new JsonConfig()
        config.registerJsonValueProcessor(Timestamp.class, new DateJsonValueProcessor());
        JSONObject json = JSONObject.fromObject(scriptVO,config);
        return json.toString();
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.