本文整理了Java中leap.lang.json.JSON.encode()
方法的一些代码示例,展示了JSON.encode()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JSON.encode()
方法的具体详情如下:
包路径:leap.lang.json.JSON
类名称:JSON
方法名:encode
[英]Encodes the value to json string.
[中]将值编码为json字符串。
代码示例来源:origin: org.leapframework/leap-orm
@Override
public Object trySerialize(FieldMapping fm, Object plain) {
return JSON.encode(plain,settings);
}
代码示例来源:origin: org.leapframework/jmms-modules-redis
public String encode(Object value) {
return null == value ? Strings.EMPTY : JSON.encode(value);
}
代码示例来源:origin: org.leapframework/jmms-engine
public String encode(Object v) {
return JSON.encode(v);
}
代码示例来源:origin: org.leapframework/leap-lang
public String serialize(Object value) {
return JSON.encode(value);
}
代码示例来源:origin: org.leapframework/leap-lang
/**
* Encodes the json value to string and set body.
*/
default HttpRequest json(Object o) {
return setJson(JSON.encode(o));
}
代码示例来源:origin: org.leapframework/leap-webapi
@Override
public T getObject() {
if(t != null){
return t;
}else if (clzz != null){
if(m != null){
t = JSON.decode(JSON.encode(m),clzz);
}
return t;
}else {
return (T)m;
}
}
}
代码示例来源:origin: org.leapframework/leap-lang
private List<KV> flat(){
List<KV> flat = new ArrayList<>();
list.forEach(kv -> {
String key = kv.key;
Object value = kv.value;
if(value == null || Beans.isSimpleProperty(value.getClass())){
flat.add(new KV(key,value));
}else {
JsonObject json = JsonObject.of(JSON.decodeMap(JSON.encode(value)));
addFlatList(key,json,flat);
}
});
return flat;
}
代码示例来源:origin: org.leapframework/leap-webapi
@Override
public <T> T insert(Class<T> resultClass, Object obj) {
String op = "";
HttpRequest request = httpClient.request(buildOperationPath(op))
.ajax()
.setJson(JSON.encode(obj, JsonSettings.MIN))
.setMethod(Method.POST);
T val = send(resultClass, request, getAccessToken());
return val;
}
代码示例来源:origin: org.leapframework/jmms-engine
public Map<String, Object> calc(String type, Map<String, Object> record) {
String op = "calc";
HttpRequest request = httpClient.request(buildOperationPath(op))
.ajax()
.addQueryParam("type", type)
.setJson(JSON.encode(record, JsonSettings.MIN))
.setMethod(HTTP.Method.POST);
return send(Map.class, request, getAccessToken());
}
代码示例来源:origin: org.leapframework/leap-webapi
@Override
public boolean update(Object id, Object partial) {
String op = idPath(id);
HttpRequest request = httpClient.request(buildOperationPath(op))
.ajax()
.setJson(JSON.encode(partial, JsonSettings.MIN))
.setMethod(Method.PATCH);
return Boolean.TRUE == send(Boolean.class, request, getAccessToken());
}
内容来源于网络,如有侵权,请联系作者删除!