Examples of JSONObject


Examples of jsontemplate_test.org.json.JSONObject

      System.exit(1);
    }
    try {
      String s = slurp(args[0]);
      System.err.println(s);
      JSONObject obj = new JSONObject(s);
      String template = (String) obj.get("template");
      JSONObject optionsDict = (JSONObject) obj.get("options");
      Object dictionary = obj.get("dictionary");
      TemplateCompileOptions options = new TemplateCompileOptions();
      if (optionsDict.has("meta")) {
        options.setMeta(optionsDict.getString("meta"));
      }
      if (optionsDict.has("default_formatter")) {
        Object defaultFormatter = optionsDict.get("default_formatter");
        if (JSONObject.NULL.equals(defaultFormatter)) {
          options.setDefaultFormatter(null);
        } else {
          options.setDefaultFormatter(defaultFormatter.toString());
        }
      }
      if (optionsDict.has("format_char")) {
        char formatChar = optionsDict.getString("format_char").charAt(0);
        options.setFormatChar(formatChar);
      }
      System.out.print(new Template(template, null, options)
          .expand(convertObject(dictionary)));
    } catch (Exception e) {
View Full Code Here

Examples of loxia.support.json.JSONObject

      response.getWriter().write("{} && ");
    if(model.size() > 0){
      if (filterString == null){       
        filterString = "**";
      }
      response.getWriter().write(new JSONObject(model,filterString).toString());
    }else{
      response.getWriter().write(new JSONObject().toString());
    }       
  }
View Full Code Here

Examples of net.jangaroo.exml.json.JsonObject

  private void ifContainerDefaultsThenExtractXtype(JsonObject jsonObject, ConfigClass configClass, String elementName) {
    // special case: extract xtype from <defaults> as <defaultType>!
    if (EXT_CONTAINER_DEFAULTS_PROPERTY.equals(elementName) && isContainerConfig(configClass)) {
      Object value = jsonObject.get(elementName);
      if (value instanceof JsonObject) {
        JsonObject jsonObjectValue = (JsonObject) value;
        // there are two ways an xtype can be specified:
        // a) as an EXML config class wrapping the JSON object:
        String xtype = jsonObjectValue.getWrapperClass();
        if (xtype != null) {
          jsonObjectValue.settingWrapperClass(null);
        } else {
          // b) as an "xtype" attribute:
          xtype = (String) jsonObjectValue.remove(ConfigClassType.XTYPE.getType());
        }
        if (xtype != null) {
          jsonObject.set(EXT_CONTAINER_DEFAULT_TYPE_PROPERTY, xtype);
        }
      }
View Full Code Here

Examples of net.minecraft.util.com.google.gson.JsonObject

public class ServerPingServerDataSerializer implements JsonDeserializer, JsonSerializer {

    public ServerPingServerDataSerializer() {}

    public ServerPingServerData a(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) {
        JsonObject jsonobject = ChatDeserializer.l(jsonelement, "version");

        return new ServerPingServerData(ChatDeserializer.h(jsonobject, "name"), ChatDeserializer.m(jsonobject, "protocol"));
    }
View Full Code Here

Examples of net.minidev.json.JSONObject

      // ignore
    }

    if (MTGOX_TRADES_CHANNEL.equals(channel) && "Y".equals(primary)) {

      JSONObject trade = JsonPath.compile("$.trade").read(message);

      outputChannel.send(MessageBuilder.withPayload(trade.toString()).build());

      // Example message:
      // {"channel":"dbf1dee9-4f2e-4a08-8cb7-748919a71b21","op":"private","origin":"broadcast","private":"trade","trade":{"amount":0.01,"amount_int":"1000000","date":1342989115,"item":"BTC","price":8.50097,"price_currency":"USD","price_int":"850097","primary":"Y","properties":"limit","tid":"1342989115044532","trade_type":"bid","type":"trade"}}
      logger.debug("Published trade: " + trade);
    }
View Full Code Here

Examples of net.sf.json.JSONObject

  }
 
  public void testGo() throws Exception{
    action.setSearchUrl(url);
    assertEquals(ActionSupport.SUCCESS,action.execute());
    JSONObject jsonObj = action.getJsonResult();
    assertNotNull(jsonObj.toString());   
  }
View Full Code Here

Examples of net.sourceforge.purrpackage.reporting.json.org.json.JSONObject

        JsonFormatterElement<CoverageSummaryView> {

    @Override
    public JSONObject format(CoverageSummaryView x, JsonFormatter utility)
            throws Exception {
        JSONObject jo = new JSONObject();
        jo.put("valid", x.getValid());
        jo.put("covered", x.getCovered());
        jo.put("samePackageCovered", x.getSamePackageCovered());
        jo.put("missed", x.getMissed());
        jo.put("samePackageMissed", x.getSamePackageMissed());
        if (!Double.isNaN(x.getRate())) {
            jo.put("rate", x.getRate());
        }
        if (!Double.isNaN(x.getSamePackageRate())) {
            jo.put("samePackageRate", x.getSamePackageRate());
        }
        jo.put("allCovered", x.getAllCovered());
        jo.put("allSamePackageCovered", x.getAllSamePackageCovered());
        return jo;
    }
View Full Code Here

Examples of net.yacy.cora.document.JSONObject

            final byte[] content = postToFile(target, "idx.json", parts, 30000);
            if (content == null || content.length == 0) {
                yacyCore.log.logWarning("yacyClient.loadIDXHosts error: empty result");
                return null;
            }
            final JSONObject json = new JSONObject(new JSONTokener(new InputStreamReader(new ByteArrayInputStream(content))));
            /* the json has the following form:
            {
            "version":"#[version]#",
            "uptime":"#[uptime]#",
            "name":"#[name]#",
            "rowdef":"#[rowdef]#",
            "idx":{
            #{list}#"#[term]#":[#[references]#]#(comma)#::,#(/comma)#
            #{/list}#
            }
            }
            */
            final JSONObject idx = json.getJSONObject("idx");
            // iterate over all references
            final Iterator<String> termIterator = idx.keys();
            String term;
            while (termIterator.hasNext()) {
                term = termIterator.next();
                final JSONArray references = idx.getJSONArray(term);
                // iterate until we get an exception or null
                int c = 0;
                String reference;
                final ReferenceContainer<HostReference> referenceContainer = new ReferenceContainer<HostReference>(WebStructureGraph.hostReferenceFactory, UTF8.getBytes(term));
                try {
View Full Code Here

Examples of org.activiti.engine.impl.util.json.JSONObject

  public String getType() {
    return TYPE;
  }
 
  public void execute(JobEntity job, String configuration, ExecutionEntity execution, CommandContext commandContext) {
    JSONObject cfgJson = new JSONObject(configuration);
    String processDefinitionId = job.getProcessDefinitionId();
    boolean activateProcessInstances = getIncludeProcessInstances(cfgJson);
   
    ActivateProcessDefinitionCmd activateProcessDefinitionCmd =
            new ActivateProcessDefinitionCmd(processDefinitionId, null, activateProcessInstances, null, job.getTenantId());
View Full Code Here

Examples of org.amplafi.json.JSONObject

    }

    @SuppressWarnings("unchecked")
    @Override
    public <T> T fromJson(Object object) {
        JSONObject json = JSONObject.toJsonObject(object);
        this.name = json.getString("name");
        this.age = json.getInt("age");
        return (T) this;
    }
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.