Package org.json.simple

Examples of org.json.simple.JSONObject.toJSONString()


    // Extract all form inputs including sensitive inputs
    JSONObject connectionJson = connectionBean.extract(false);

    String response = super.put(serverUrl + RESOURCE
                                  + connection.getPersistenceId(),
                                connectionJson.toJSONString());

    ValidationBean validationBean = new ValidationBean();
    validationBean.restore((JSONObject) JSONValue.parse(response));

    return validationBean;
View Full Code Here


    // Extract all form inputs including sensitive inputs
    JSONObject jobJson = jobBean.extract(false);

    String response = super.post(serverUrl + RESOURCE,
      jobJson.toJSONString());

    ValidationBean validationBean = new ValidationBean();
    validationBean.restore((JSONObject) JSONValue.parse(response));

    return validationBean;
View Full Code Here

    // Extract all form inputs including sensitive inputs
    JSONObject jobJson = jobBean.extract(false);

    String response = super.put(serverUrl + RESOURCE + job.getPersistenceId(),
                                jobJson.toJSONString());

    ValidationBean validationBean = new ValidationBean();
    validationBean.restore((JSONObject) JSONValue.parse(response));

    return validationBean;
View Full Code Here

    // Serialize it to JSON object
    JobBean bean = new JobBean(job);
    JSONObject json = bean.extract(false);

    // "Move" it across network in text form
    String string = json.toJSONString();

    // Retrieved transferred object
    JSONObject retrievedJson = (JSONObject)JSONValue.parseWithException(string);
    JobBean retrievedBean = new JobBean();
    retrievedBean.restore(retrievedJson);
View Full Code Here

  @Override
  protected Schema transfer(Schema schema) {
    SchemaBean extractBean = new SchemaBean(schema);
    JSONObject extractJson = extractBean.extract(true);

    String transferredString = extractJson.toJSONString();

    JSONObject restoreJson = (JSONObject) JSONValue.parse(transferredString);
    SchemaBean restoreBean = new SchemaBean();
    restoreBean.restore(restoreJson);
View Full Code Here

    // Serialize that into JSON
    JSONObject jsonObject = FormSerialization.extractForm(form, false);
    assertNotNull(jsonObject);

    // Exchange the data on string level
    String serializedJson = jsonObject.toJSONString();
    JSONObject retrievedJson = (JSONObject) JSONValue.parse(serializedJson);

    // And retrieve back from JSON representation
    MForm retrieved = FormSerialization.restoreForm(retrievedJson);
View Full Code Here

    map.put("A", "B");
    form.getMapInput("Map").setValue(map);

    // Serialize
    JSONObject jsonObject = FormSerialization.extractForm(form, false);
    String serializedJson = jsonObject.toJSONString();

    // Deserialize
    JSONObject retrievedJson = (JSONObject) JSONValue.parse(serializedJson);
    MForm retrieved = FormSerialization.restoreForm(retrievedJson);
    assertEquals(map, retrieved.getMapInput("Map").getValue());
View Full Code Here

    map.put("A", "B");
    form.getMapInput("Map").setValue(map);

    // Serialize
    JSONObject jsonObject = FormSerialization.extractForm(form, false);
    String serializedJson = jsonObject.toJSONString();

    // Replace map value with a fake string to force exception
    String badSerializedJson = serializedJson.replace("{\"A\":\"B\"}", "\"nonsensical string\"");
    System.out.println(badSerializedJson);
    JSONObject retrievedJson = (JSONObject) JSONValue.parse(badSerializedJson);
View Full Code Here

  }

  protected Schema transfer(Schema schema) {
    JSONObject extractJson = SchemaSerialization.extractSchema(schema);

    String transferredString = extractJson.toJSONString();

    JSONObject restoreJson = (JSONObject) JSONValue.parse(transferredString);
    return SchemaSerialization.restoreSchemna(restoreJson);
  }
}
View Full Code Here

      getValidation(Status.UNACCEPTABLE)
    );
    JSONObject json = bean.extract();

    // "Move" it across network in text form
    String string = json.toJSONString();

    // Retrieved transferred object
    JSONObject retrievedJson = (JSONObject) JSONValue.parse(string);
    ValidationBean retrievedBean = new ValidationBean();
    retrievedBean.restore(retrievedJson);
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.