本文整理了Java中org.n52.janmayen.Json
类的一些代码示例,展示了Json
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Json
类的具体详情如下:
包路径:org.n52.janmayen.Json
类名称:Json
[英]TODO JavaDoc
[中]TODO JavaDoc
代码示例来源:origin: 52North/SOS
public static String mapToJson(@SuppressWarnings("rawtypes") Map map) {
ObjectNode node = Json.nodeFactory().objectNode();
for (Object key : map.keySet()) {
node.put(key.toString(), String.valueOf(map.get(key)));
}
return Json.print(node);
}
代码示例来源:origin: org.n52.arctic-sea/svalbard-json-common
public ProcessingReport validate(String json, String schema)
throws IOException {
return validate(Json.loadString(json), schema);
}
代码示例来源:origin: org.n52.arctic-sea/svalbard-json-common
public ProcessingReport validate(File file, String schema)
throws IOException {
return validate(Json.loadFile(file), schema);
}
代码示例来源:origin: org.n52.sensorweb.sos/admin-controller
private static String asJSONArray(
Collection<String> coll) {
return Json.print(Json.toJSON(new TreeSet<String>(coll)));
}
}
代码示例来源:origin: org.n52.janmayen/janmayen
public static ObjectNode toJSON(Map<String, ?> map) {
ObjectNode node = nodeFactory().objectNode();
Optional.ofNullable(map).orElseGet(Collections::emptyMap)
.forEach((key, value) -> node.set(key, toJSONString(value)));
return node;
}
代码示例来源:origin: org.n52.iceland/iceland
@Override
public void write(JsonNode t, OutputStream out, ResponseProxy responseProxy)
throws IOException {
Json.print(out, t);
}
代码示例来源:origin: org.n52.arctic-sea/svalbard-json-common
protected JsonNodeFactory nodeFactory() {
return Json.nodeFactory();
}
代码示例来源:origin: org.n52.sensorweb.sos/install-controller
final HttpSession session = req.getSession();
InstallationConfiguration c = getSettings(session);
JsonNode settings = Json.loadString(config);
Iterator<String> i = settings.fieldNames();
while (i.hasNext()) {
String key = i.next();
if (settings.path(key).isContainerNode()) {
value = Json.print(settings.path(key));
} else {
value = settings.path(key).asText();
代码示例来源:origin: org.n52.iceland/iceland
private OwsServiceRequest parseRequest(HttpServletRequest request)
throws OwsExceptionReport {
try {
JsonNode json = Json.loadReader(request.getReader());
if (LOG.isDebugEnabled()) {
LOG.debug("JSON-REQUEST: {}", Json.print(json));
代码示例来源:origin: org.n52.janmayen/janmayen
public static JsonNode loadString(final String json) {
try {
return loadReader(new StringReader(json));
} catch (IOException ex) {
// cannot happen
throw new Error(ex);
}
}
代码示例来源:origin: org.n52.arctic-sea/svalbard-json-common
public ProcessingReport validate(URL url, String schema)
throws IOException {
return validate(Json.loadURL(url), schema);
}
代码示例来源:origin: org.n52.janmayen/janmayen
public static String print(JsonNode node) {
try (StringWriter writer = new StringWriter()) {
print(writer, node);
writer.flush();
return writer.toString();
} catch (IOException ex) {
// can not happen
throw new Error(ex);
}
}
代码示例来源:origin: org.n52.arctic-sea/svalbard-json
JsonNodeFactory nodeFactory() {
return Json.nodeFactory();
}
代码示例来源:origin: 52North/SOS
private static String asJSONArray(
Collection<String> coll) {
return Json.print(Json.toJSON(new TreeSet<String>(coll)));
}
}
代码示例来源:origin: 52North/SOS
final HttpSession session = req.getSession();
InstallationConfiguration c = getSettings(session);
JsonNode settings = Json.loadString(config);
Iterator<String> i = settings.fieldNames();
while (i.hasNext()) {
String key = i.next();
if (settings.path(key).isContainerNode()) {
value = Json.print(settings.path(key));
} else {
value = settings.path(key).asText();
代码示例来源:origin: org.n52.arctic-sea/svalbard-json-common
public ProcessingReport validate(Reader reader, String schema)
throws IOException {
return validate(Json.loadReader(reader), schema);
}
代码示例来源:origin: org.n52.arctic-sea/svalbard-json-common
public boolean isValid(URL url, String schema)
throws IOException {
return isValid(Json.loadURL(url), schema);
}
代码示例来源:origin: org.n52.sensorweb.sos/common-controller
public static String mapToJson(@SuppressWarnings("rawtypes") Map map) {
ObjectNode node = Json.nodeFactory().objectNode();
for (Object key : map.keySet()) {
node.put(key.toString(), String.valueOf(map.get(key)));
}
return Json.print(node);
}
代码示例来源:origin: org.n52.sensorweb.sos/admin-controller
@ResponseBody
@ResponseStatus(HttpStatus.OK)
@RequestMapping(method = RequestMethod.GET,
produces = ControllerConstants.MEDIA_TYPE_APPLICATION_JSON)
public String get()
throws NoImplementationFoundException, JSONException,
OwsExceptionReport {
Iterable<T> i18n = getDao().getMetadata();
return Json.print(encoder.encode(i18n));
}
代码示例来源:origin: org.n52.janmayen/janmayen
public static ArrayNode toJSON(Collection<?> coll) {
return Optional.ofNullable(coll)
.map(Collection::stream)
.orElseGet(Stream::empty).map(Json::toJSONString)
.collect(Collector.of(nodeFactory()::arrayNode, ArrayNode::add, ArrayNode::addAll));
}
内容来源于网络,如有侵权,请联系作者删除!