Refine search
public static void main(String[] args) throws IOException { // convert Java to writer JsonObject root = Json.object().add("message", "Hi").add( "place", Json.object().add("name", "World!") ); StringWriter writer = new StringWriter(); root.writeTo(writer); String json = writer.toString(); System.out.println(json); System.out.println(); // convert writer to Java JsonObject obj = Json.parse(json).asObject(); String message = obj.get("message").asString(); String name = obj.get("place").asObject().get("name").asString(); System.out.println(message + " " + name); } }
if (json.get("platform") != null) { platform = Platform.byDesc(json.get("platform").asString()); if (json.get("jdk") != null) { jdk = json.get("jdk").asString(); if (json.get("executable") != null) { executable = json.get("executable").asString(); if (json.get("classpath") != null) { if (json.get("mainclass") != null) { mainClass = json.get("mainclass").asString(); if (json.get("minimizejre") != null) { minimizeJre = json.get("minimizejre").asString(); if (json.get("cachejre") != null) { cacheJre = new File(json.get("cachejre").asString()); if (json.get("output") != null) { outDir = new File(json.get("output").asString()); if (json.get("icon") != null) { iconResource = new File(json.get("icon").asString()); if (json.get("bundle") != null) { bundleIdentifier = json.get("bundle").asString();
JsonArray reduceArray = minimizeJson.get("reduce").asArray(); for (JsonValue reduce : reduceArray) { String path = reduce.asObject().get("archive").asString(); File file = new File(output, path); JsonArray removeArray = reduce.asObject().get("paths").asArray(); for (JsonValue remove : removeArray) { File removeFile = new File(fileNoExt, remove.asString()); if (removeFile.exists()) { if (removeFile.isDirectory()) { JsonArray removeArray = minimizeJson.get("remove").asArray(); for (JsonValue remove : removeArray) { String platform = remove.asObject().get("platform").asString(); JsonArray removeFilesArray = remove.asObject().get("paths").asArray(); for (JsonValue removeFile : removeFilesArray) { removeFileWildcard(output, removeFile.asString(), config);
/** * Returns the <code>String</code> value of the member with the specified name in this object. If * this object does not contain a member with this name, the given default value is returned. If * this object contains multiple members with the given name, the last one is picked. If this * member's value does not represent a JSON string, an exception is thrown. * * @param name * the name of the member whose value is to be returned * @param defaultValue * the value to be returned if the requested member is missing * @return the value of the last member with the specified name, or the given default value if * this object does not contain a member with that name */ public String getString(String name, String defaultValue) { JsonValue value = get(name); return value != null ? value.asString() : defaultValue; }
@Override public void handle(SkypeImpl skype, JsonObject resource) throws ConnectionException, ChatNotFoundException, IOException { String from = resource.get("from").asString(); String url = resource.get("conversationLink").asString(); String content = resource.get("content").asString(); boolean finished = content.startsWith("<ended/>") || content.startsWith("<partlist type=\"ended\""); ChatImpl c = getChat(url, skype); Participant u = getUser(from, c); CallReceivedEvent event = new CallReceivedEvent(c, u, !finished); skype.getEventDispatcher().callEvent(event); } },
private void updateAccessibleBy(JsonObject json) { String type = json.get("type").asString(); if ((type.equals("user") && this.accessibleBy instanceof BoxUser.Info) || (type.equals("group") && this.accessibleBy instanceof BoxGroup.Info)) { this.accessibleBy.update(json); } else { this.accessibleBy = this.parseAccessibleBy(json); } }