本文整理了Java中leap.lang.json.JSON.stringify()
方法的一些代码示例,展示了JSON.stringify()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JSON.stringify()
方法的具体详情如下:
包路径:leap.lang.json.JSON
类名称:JSON
方法名:stringify
[英]Encodes the value to json string.
Same as #encode(Object).
[中]将值编码为json字符串。
与#编码(对象)相同。
代码示例来源:origin: org.leapframework/leap-lang
@Override
public String toString() {
return JSON.stringify(map);
}
}
代码示例来源:origin: org.leapframework/jmms-engine
public String json(Object o) {
return JSON.stringify(o);
}
代码示例来源:origin: org.leapframework/jmms-engine
public String stringify(Object v) {
return JSON.stringify(v);
}
代码示例来源:origin: org.leapframework/jmms-plugins-swagger-doc
@Override
public void execute(Options options) {
options.append(JSON.stringify(options.getParameters().get(0)));
}
}
代码示例来源:origin: org.leapframework/leap-webunit
/**
* Sets the json content type and body.
*/
default THttpRequest setJson(Object value) {
setContentType(ContentTypes.APPLICATION_JSON_UTF8);
return setBody(JSON.stringify(value));
}
代码示例来源:origin: org.leapframework/jmms-engine
protected void output(int status, Object result) {
Output out = new Output();
out.status = status;
out.result = result;
writer.println(OUTPUT_PREFIX + JSON.stringify(out) + OUTPUT_SUFFIX);
}
代码示例来源:origin: org.leapframework/jmms-engine
private void processReferenceToCompositeId(MetaApi api, MetaEntity entity, Map<String, MetaRelation> relations) {
relations.forEach((name, relation) -> {
//check relation exists.
if (entity.getRelation(name) != null) {
throw new IllegalStateException("Found duplicate relation '" + name + "' -> '");
}
MetaEntity targetEntity = api.getEntity(relation.getTargetEntity());
Map<String, MetaField> targetId = targetEntity.getIdentity();
if (relation.getJoinFields().size() != targetId.size()) {
throw new IllegalStateException("Incorrect size of join fields " + JSON.stringify(relation.getJoinFields())
+ " , expected " + targetId.size() + " but " + relation.getJoinFields().size() +
", check relation '" + name + "'");
}
entity.addRelation(relation);
});
}
代码示例来源:origin: org.leapframework/leap-webapi
protected MType readType(String name, JsonObject property, SwaggerExtension ex) {
String ref = property.getString(REF);
if(!Strings.isEmpty(ref)) {
return readRefType(ref);
}
String type = property.getString(TYPE);
if(Strings.isEmpty(type)) {
if(!validate) {
return null;
}
throw new InvalidSpecException("Invalid type in property : " + JSON.stringify(property.raw()));
}
MType mtype = null != ex ? ex.readType(type) : null;
if(null != mtype) {
return mtype;
}
if(type.equals(OBJECT)) {
return readObjectType(name, property);
}
if(type.equals(ARRAY)) {
return readCollectionType(property.getObject(ITEMS), ex);
}
String format = property.getString(FORMAT);
return readSimpleType(type, format);
}
代码示例来源:origin: org.leapframework/jmms-engine
List<String> values = new ArrayList<>();
os.getItems().forEach(o -> {
values.add(JSON.stringify(o.getValue()));
});
v.setEnumValues(values.toArray(new String[0]));
内容来源于网络,如有侵权,请联系作者删除!