本文整理了Java中play.libs.Json.stringify()
方法的一些代码示例,展示了Json.stringify()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Json.stringify()
方法的具体详情如下:
包路径:play.libs.Json
类名称:Json
方法名:stringify
[英]Converts a JsonNode to its string representation.
[中]将JsonNode转换为其字符串表示形式。
代码示例来源:origin: com.typesafe.play/play
return ((RawBuffer) body).asBytes();
} else if (body instanceof JsonNode) {
return ByteString.fromString(Json.stringify((JsonNode) body));
} else if (body instanceof Document) {
return XML.toBytes((Document) body);
代码示例来源:origin: com.typesafe.play/play_2.12
return ((RawBuffer) body).asBytes();
} else if (body instanceof JsonNode) {
return ByteString.fromString(Json.stringify((JsonNode) body));
} else if (body instanceof Document) {
return XML.toBytes((Document) body);
代码示例来源:origin: com.typesafe.play/play_2.11
return ((RawBuffer) body).asBytes();
} else if (body instanceof JsonNode) {
return ByteString.fromString(Json.stringify((JsonNode) body));
} else if (body instanceof Document) {
return XML.toBytes((Document) body);
代码示例来源:origin: com.typesafe.play/play-java_2.12
@Override
public String body() {
return padding + "(" + Json.stringify(json) + ");";
}
代码示例来源:origin: com.typesafe.play/play-java_2.10
@Override
public String body() {
return padding + "(" + Json.stringify(json) + ");";
}
代码示例来源:origin: com.typesafe.play/play-java_2.11
@Override
public String body() {
return padding + "(" + Json.stringify(json) + ");";
}
代码示例来源:origin: com.typesafe.play/play-java
@Override
public String body() {
return padding + "(" + Json.stringify(json) + ");";
}
代码示例来源:origin: com.typesafe.play/play-java_2.12
/**
* @param json Json value to use
* @return An event with a string representation of {@code json} as content
*/
public static Event event(JsonNode json) {
return new Event(Json.stringify(json), null, null);
}
代码示例来源:origin: com.typesafe.play/play-java_2.10
/**
* @param json Json value to use
* @return An event with a string representation of {@code json} as content
*/
public static Event event(JsonNode json) {
return new Event(Json.stringify(json), null, null);
}
代码示例来源:origin: com.typesafe.play/play-java_2.10
/**
* Send a Json message on this socket (will be received as Json in the Javascript callback method).
*/
public void sendMessage(JsonNode message) {
out.write("<script type=\"text/javascript\">" + callbackMethod + "(" + Json.stringify(message) + ");</script>");
}
代码示例来源:origin: com.typesafe.play/play-java_2.11
/**
* @param json Json value to use
* @return An event with a string representation of {@code json} as content
*/
public static Event event(JsonNode json) {
return new Event(Json.stringify(json), null, null);
}
代码示例来源:origin: com.typesafe.play/play-java
/**
* @param json Json value to use
* @return An event with a string representation of {@code json} as content
*/
public static Event event(JsonNode json) {
return new Event(Json.stringify(json), null, null);
}
代码示例来源:origin: play/play-java
/**
* Send a Json message on this socket (will be received as Json in the Javascript callback method).
*/
public void sendMessage(JsonNode message) {
out.write("<script type=\"text/javascript\">" + callbackMethod + "(" + Json.stringify(message) + ");</script>");
}
代码示例来源:origin: com.commercetools.sunrise/common
/**
* {@inheritDoc}
*/
@Override
public <U> void overwriteObjectByKey(final String key, final U object) {
final JsonNode jsonNode = Json.toJson(object);
final String valueAsJson = Json.stringify(jsonNode);
overwriteValueByKey(key, valueAsJson);
}
代码示例来源:origin: com.typesafe.play/play-java-forms_2.11
@Override
public DynamicForm bind(Lang lang, TypedMap attrs, JsonNode data, String... allowedFields) {
return bind(lang, attrs,
play.libs.Scala.asJava(
play.api.data.FormUtils.fromJson("",
play.api.libs.json.Json.parse(
play.libs.Json.stringify(data)
)
)
),
allowedFields
);
}
代码示例来源:origin: com.typesafe.play/play-java-forms
@Override
public DynamicForm bind(Lang lang, TypedMap attrs, JsonNode data, String... allowedFields) {
return bind(lang, attrs,
play.libs.Scala.asJava(
play.api.data.FormUtils.fromJson("",
play.api.libs.json.Json.parse(
play.libs.Json.stringify(data)
)
)
),
allowedFields
);
}
代码示例来源:origin: com.typesafe.play/play-java
/**
* Produces a flow of ByteString using `Json.stringify` from a Flow of JsonNode. Calls
* out to Comet.flow internally.
*
* @param callbackName the javascript callback method.
* @return a flow of ByteString elements.
*/
public static Flow<JsonNode, ByteString, NotUsed> json(String callbackName) {
return Flow.of(JsonNode.class).map(json -> {
return ByteString.fromString(Json.stringify(json));
}).via(flow(callbackName));
}
代码示例来源:origin: com.typesafe.play/play-java_2.11
/**
* Produces a flow of ByteString using `Json.stringify` from a Flow of JsonNode. Calls
* out to Comet.flow internally.
*
* @param callbackName the javascript callback method.
* @return a flow of ByteString elements.
*/
public static Flow<JsonNode, ByteString, NotUsed> json(String callbackName) {
return Flow.of(JsonNode.class).map(json -> {
return ByteString.fromString(Json.stringify(json));
}).via(flow(callbackName));
}
代码示例来源:origin: com.typesafe.play/play-java_2.12
/**
* Produces a flow of ByteString using `Json.stringify` from a Flow of JsonNode. Calls
* out to Comet.flow internally.
*
* @param callbackName the javascript callback method.
* @return a flow of ByteString elements.
*/
public static Flow<JsonNode, ByteString, NotUsed> json(String callbackName) {
return Flow.of(JsonNode.class).map(json -> {
return ByteString.fromString(Json.stringify(json));
}).via(flow(callbackName));
}
代码示例来源:origin: play/play-java
private Promise<Response> executeJson(String method, JsonNode body) {
WSRequest req = new WSRequest(method).setBody(Json.stringify(body))
.setUrl(url)
.setHeaders(headers)
.setHeader(HttpHeaders.Names.CONTENT_TYPE, "application/json; charset=utf-8")
.setQueryParameters(new FluentStringsMap(queryParameters))
.setBodyEncoding("utf-8");
return execute(req);
}
内容来源于网络,如有侵权,请联系作者删除!