本文整理了Java中net.sf.json.JSONSerializer
类的一些代码示例,展示了JSONSerializer
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JSONSerializer
类的具体详情如下:
包路径:net.sf.json.JSONSerializer
类名称:JSONSerializer
暂无
代码示例来源:origin: geoserver/geoserver
protected JSON json(MockHttpServletResponse response) throws UnsupportedEncodingException {
String content = response.getContentAsString();
return JSONSerializer.toJSON(content);
}
代码示例来源:origin: itesla/ipst
public static Collection<String> jsonToContingenciesIds(String json) {
return (Collection<String>) JSONSerializer.toJava(JSONSerializer.toJSON(json));
}
代码示例来源:origin: edu.uiuc.ncsa.myproxy/oa4mp-server-loader-oauth2
@Override
public V fromJSON(JSONObject json) {
V v = super.fromJSON(json);
v.setRtLifetime(getJsonUtil().getJSONValueLong(json, getCK2().rtLifetime()));
v.setIssuer(getJsonUtil().getJSONValueString(json, getCK2().issuer()));
v.setSignTokens(getJsonUtil().getJSONValueBoolean(json, getCK2().signTokens()));
v.setPublicClient(getJsonUtil().getJSONValueBoolean(json, getCK2().publicClient())); // JSON util returns false if missing key
JSON cbs = (JSON) getJsonUtil().getJSONValue(json, getCK2().callbackUri());
if (cbs != null && cbs instanceof JSONArray) {
JSONArray array = (JSONArray) json.getJSONObject(getJSONComponentName()).get(getCK2().callbackUri());
Collection<String> zzz = (Collection<String>) JSONSerializer.toJava(array);
v.setCallbackURIs(zzz);
}
JSON scopes = (JSON) getJsonUtil().getJSONValue(json, getCK2().scopes());
if (scopes != null && scopes instanceof JSONArray) {
JSONArray array = (JSONArray) json.getJSONObject(getJSONComponentName()).get(getCK2().scopes());
Collection<String> zzz = (Collection<String>) JSONSerializer.toJava(array);
v.setScopes(zzz);
}
JSON ldaps = (JSON) getJsonUtil().getJSONValue(json, getCK2().ldap());
if (ldaps != null) {
v.setLdaps(getLdapConfigurationUtil().fromJSON(ldaps));
}
JSONObject config = (JSONObject) getJsonUtil().getJSONValue(json, getCK2().cfg());
if (config != null) {
v.setConfig(config);
}
return v;
}
代码示例来源:origin: itesla/ipst
public static Collection<Integer> jsonToStatesIds(String json) {
return (Collection<Integer>) JSONSerializer.toJava(JSONSerializer.toJSON(json));
}
代码示例来源:origin: geoserver/geoserver
protected JSON json(MockHttpServletResponse response) throws UnsupportedEncodingException {
String content = response.getContentAsString();
return JSONSerializer.toJSON(content);
}
代码示例来源:origin: itesla/ipst
public static List<String> jsonToActionsIds(String json) {
return (List<String>) JSONSerializer.toJava(JSONSerializer.toJSON(json));
}
代码示例来源:origin: jenkinsci/pipeline-aws-plugin
public static Object fromString(String string) {
return JSONSerializer.toJSON(string);
}
代码示例来源:origin: edu.uiuc.ncsa.myproxy/oa4mp-server-loader-oauth2
protected Collection<String> jsonArrayToCollection(ConversionMap<String, Object> map, String key) {
JSONArray json = (JSONArray) JSONSerializer.toJSON(map.get(key));
Collection<String> zzz = (Collection<String>) JSONSerializer.toJava(json);
return zzz;
}
代码示例来源:origin: geosolutions-it/geoserver-manager
public static JSON json(String content) {
return JSONSerializer.toJSON(content);
}
代码示例来源:origin: itesla/ipst
public static Set<SecurityIndexType> jsonToIndexesTypes(String json) {
List<String> securityIndexesTypes = (List<String>) JSONSerializer.toJava(JSONSerializer.toJSON(json));
Set<SecurityIndexType> securityIndexes = securityIndexesTypes.stream().map(SecurityIndexType::valueOf).collect(Collectors.toSet());
return securityIndexes;
}
代码示例来源:origin: liimaorg/liima
public void setApplicationsWithVersion(List<ApplicationWithVersion> applicationsWithVersion) {
JSON json = JSONSerializer.toJSON(applicationsWithVersion);
this.applicationsWithVersion = json.toString();
applicationsWithVersionList = null;
}
代码示例来源:origin: itesla/ipst
public static Set<Country> jsonToCountries(String json) {
List<String> countryNames = (List<String>) JSONSerializer.toJava(JSONSerializer.toJSON(json));
Set<Country> countries = countryNames.stream().map(Country::valueOf).collect(Collectors.toSet());
return countries;
}
代码示例来源:origin: liimaorg/liima
public void setApplicationsFromApplicationServer(List<ApplicationsFromApplicationServer> applicationsFromApplicationServer) {
JSON json = JSONSerializer.toJSON(applicationsFromApplicationServer);
this.appsFromAppServer = json.toString();
}
代码示例来源:origin: pl.edu.icm.sedno/sedno-tools
public Object[] fromJsonArray(String json) {
if (StringUtils.isEmpty(json))
return null;
JSONArray jsonArray = (JSONArray) JSONSerializer.toJSON( json );
JsonConfig jsonConfig = new JsonConfig();
jsonConfig.setArrayMode( JsonConfig.MODE_OBJECT_ARRAY );
Object[] output = (Object[]) JSONSerializer.toJava( jsonArray, jsonConfig );
//instancjonowanie tablicy odpowiedniego typu
Object[] concreteArrayOutput = ReflectionUtil.invokeArrayConstructor(returnedClass(), output.length);
System.arraycopy(output, 0, concreteArrayOutput, 0, output.length);
return concreteArrayOutput;
}
}
代码示例来源:origin: itesla/ipst
public static String actionsIdsToJson(List<String> actionsIds) {
return JSONSerializer.toJSON(actionsIds).toString();
}
代码示例来源:origin: itesla/ipst
public static ActionParameters jsonToActionParameters(String json) {
ActionParameters actionParameters = new ActionParameters();
if (json != null) {
List<Object> parameters = (List<Object>) JSONSerializer.toJava(JSONSerializer.toJSON(json));
for (Object parameterObject : parameters) {
JSONObject parameterJsonObject = JSONObject.fromObject(parameterObject);
代码示例来源:origin: itesla/ipst
public static String stateIdsToJson(Collection<Integer> statesIds) {
return JSONSerializer.toJSON(statesIds).toString();
}
代码示例来源:origin: edu.uiuc.ncsa.myproxy/oa4mp-server-loader-oauth2
@Override
public V fromMap(ConversionMap<String, Object> map, V v) {
V st = super.fromMap(map, v);
Object refreshToken = map.get(getTCK().refreshToken());
if (refreshToken != null) {
if (refreshToken instanceof RefreshToken) {
st.setRefreshToken((RefreshToken) refreshToken);
} else {
st.setRefreshToken(getTF2().getRefreshToken(refreshToken.toString()));
}
}
st.setRefreshTokenValid(map.getBoolean(getTCK().refreshTokenValid()));
st.setRefreshTokenLifetime(map.getLong(getTCK().expiresIn()));
st.setCallback(map.getURI(getTCK().callbackUri()));
st.setNonce(map.getString(getTCK().nonce()));
if (map.get(getTCK().scopes()) != null) {
net.sf.json.JSONArray json = (JSONArray) JSONSerializer.toJSON(map.get(getTCK().scopes()));
Collection<String> zzz = (Collection<String>) JSONSerializer.toJava(json);
st.setScopes(zzz);
}
if (map.get(getTCK().authTime()) != null) {
st.setAuthTime(map.getDate(getTCK().authTime));
}
if (map.get(getTCK().states()) != null) {
st.setState((JSONObject) JSONSerializer.toJSON(map.get(getTCK().states())));
} else {
st.setState(new JSONObject());
}
return st;
}
代码示例来源:origin: itesla/ipst
public static String contingenciesIdsToJson(Collection<String> contingenciesIds) {
return JSONSerializer.toJSON(contingenciesIds).toString();
}
代码示例来源:origin: itesla/ipst
public static String indexesDataToJson(Map<String, Boolean> indexesData) {
return JSONSerializer.toJSON(indexesData).toString();
}
内容来源于网络,如有侵权,请联系作者删除!