net.sf.json.JSONSerializer类的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(6.9k)|赞(0)|评价(0)|浏览(175)

本文整理了Java中net.sf.json.JSONSerializer类的一些代码示例,展示了JSONSerializer类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JSONSerializer类的具体详情如下:
包路径:net.sf.json.JSONSerializer
类名称:JSONSerializer

JSONSerializer介绍

暂无

代码示例

代码示例来源:origin: geoserver/geoserver

  1. protected JSON json(MockHttpServletResponse response) throws UnsupportedEncodingException {
  2. String content = response.getContentAsString();
  3. return JSONSerializer.toJSON(content);
  4. }

代码示例来源:origin: itesla/ipst

  1. public static Collection<String> jsonToContingenciesIds(String json) {
  2. return (Collection<String>) JSONSerializer.toJava(JSONSerializer.toJSON(json));
  3. }

代码示例来源:origin: edu.uiuc.ncsa.myproxy/oa4mp-server-loader-oauth2

  1. @Override
  2. public V fromJSON(JSONObject json) {
  3. V v = super.fromJSON(json);
  4. v.setRtLifetime(getJsonUtil().getJSONValueLong(json, getCK2().rtLifetime()));
  5. v.setIssuer(getJsonUtil().getJSONValueString(json, getCK2().issuer()));
  6. v.setSignTokens(getJsonUtil().getJSONValueBoolean(json, getCK2().signTokens()));
  7. v.setPublicClient(getJsonUtil().getJSONValueBoolean(json, getCK2().publicClient())); // JSON util returns false if missing key
  8. JSON cbs = (JSON) getJsonUtil().getJSONValue(json, getCK2().callbackUri());
  9. if (cbs != null && cbs instanceof JSONArray) {
  10. JSONArray array = (JSONArray) json.getJSONObject(getJSONComponentName()).get(getCK2().callbackUri());
  11. Collection<String> zzz = (Collection<String>) JSONSerializer.toJava(array);
  12. v.setCallbackURIs(zzz);
  13. }
  14. JSON scopes = (JSON) getJsonUtil().getJSONValue(json, getCK2().scopes());
  15. if (scopes != null && scopes instanceof JSONArray) {
  16. JSONArray array = (JSONArray) json.getJSONObject(getJSONComponentName()).get(getCK2().scopes());
  17. Collection<String> zzz = (Collection<String>) JSONSerializer.toJava(array);
  18. v.setScopes(zzz);
  19. }
  20. JSON ldaps = (JSON) getJsonUtil().getJSONValue(json, getCK2().ldap());
  21. if (ldaps != null) {
  22. v.setLdaps(getLdapConfigurationUtil().fromJSON(ldaps));
  23. }
  24. JSONObject config = (JSONObject) getJsonUtil().getJSONValue(json, getCK2().cfg());
  25. if (config != null) {
  26. v.setConfig(config);
  27. }
  28. return v;
  29. }

代码示例来源:origin: itesla/ipst

  1. public static Collection<Integer> jsonToStatesIds(String json) {
  2. return (Collection<Integer>) JSONSerializer.toJava(JSONSerializer.toJSON(json));
  3. }

代码示例来源:origin: geoserver/geoserver

  1. protected JSON json(MockHttpServletResponse response) throws UnsupportedEncodingException {
  2. String content = response.getContentAsString();
  3. return JSONSerializer.toJSON(content);
  4. }

代码示例来源:origin: itesla/ipst

  1. public static List<String> jsonToActionsIds(String json) {
  2. return (List<String>) JSONSerializer.toJava(JSONSerializer.toJSON(json));
  3. }

代码示例来源:origin: jenkinsci/pipeline-aws-plugin

  1. public static Object fromString(String string) {
  2. return JSONSerializer.toJSON(string);
  3. }

代码示例来源:origin: edu.uiuc.ncsa.myproxy/oa4mp-server-loader-oauth2

  1. protected Collection<String> jsonArrayToCollection(ConversionMap<String, Object> map, String key) {
  2. JSONArray json = (JSONArray) JSONSerializer.toJSON(map.get(key));
  3. Collection<String> zzz = (Collection<String>) JSONSerializer.toJava(json);
  4. return zzz;
  5. }

代码示例来源:origin: geosolutions-it/geoserver-manager

  1. public static JSON json(String content) {
  2. return JSONSerializer.toJSON(content);
  3. }

代码示例来源:origin: itesla/ipst

  1. public static Set<SecurityIndexType> jsonToIndexesTypes(String json) {
  2. List<String> securityIndexesTypes = (List<String>) JSONSerializer.toJava(JSONSerializer.toJSON(json));
  3. Set<SecurityIndexType> securityIndexes = securityIndexesTypes.stream().map(SecurityIndexType::valueOf).collect(Collectors.toSet());
  4. return securityIndexes;
  5. }

代码示例来源:origin: liimaorg/liima

  1. public void setApplicationsWithVersion(List<ApplicationWithVersion> applicationsWithVersion) {
  2. JSON json = JSONSerializer.toJSON(applicationsWithVersion);
  3. this.applicationsWithVersion = json.toString();
  4. applicationsWithVersionList = null;
  5. }

代码示例来源:origin: itesla/ipst

  1. public static Set<Country> jsonToCountries(String json) {
  2. List<String> countryNames = (List<String>) JSONSerializer.toJava(JSONSerializer.toJSON(json));
  3. Set<Country> countries = countryNames.stream().map(Country::valueOf).collect(Collectors.toSet());
  4. return countries;
  5. }

代码示例来源:origin: liimaorg/liima

  1. public void setApplicationsFromApplicationServer(List<ApplicationsFromApplicationServer> applicationsFromApplicationServer) {
  2. JSON json = JSONSerializer.toJSON(applicationsFromApplicationServer);
  3. this.appsFromAppServer = json.toString();
  4. }

代码示例来源:origin: pl.edu.icm.sedno/sedno-tools

  1. public Object[] fromJsonArray(String json) {
  2. if (StringUtils.isEmpty(json))
  3. return null;
  4. JSONArray jsonArray = (JSONArray) JSONSerializer.toJSON( json );
  5. JsonConfig jsonConfig = new JsonConfig();
  6. jsonConfig.setArrayMode( JsonConfig.MODE_OBJECT_ARRAY );
  7. Object[] output = (Object[]) JSONSerializer.toJava( jsonArray, jsonConfig );
  8. //instancjonowanie tablicy odpowiedniego typu
  9. Object[] concreteArrayOutput = ReflectionUtil.invokeArrayConstructor(returnedClass(), output.length);
  10. System.arraycopy(output, 0, concreteArrayOutput, 0, output.length);
  11. return concreteArrayOutput;
  12. }
  13. }

代码示例来源:origin: itesla/ipst

  1. public static String actionsIdsToJson(List<String> actionsIds) {
  2. return JSONSerializer.toJSON(actionsIds).toString();
  3. }

代码示例来源:origin: itesla/ipst

  1. public static ActionParameters jsonToActionParameters(String json) {
  2. ActionParameters actionParameters = new ActionParameters();
  3. if (json != null) {
  4. List<Object> parameters = (List<Object>) JSONSerializer.toJava(JSONSerializer.toJSON(json));
  5. for (Object parameterObject : parameters) {
  6. JSONObject parameterJsonObject = JSONObject.fromObject(parameterObject);

代码示例来源:origin: itesla/ipst

  1. public static String stateIdsToJson(Collection<Integer> statesIds) {
  2. return JSONSerializer.toJSON(statesIds).toString();
  3. }

代码示例来源:origin: edu.uiuc.ncsa.myproxy/oa4mp-server-loader-oauth2

  1. @Override
  2. public V fromMap(ConversionMap<String, Object> map, V v) {
  3. V st = super.fromMap(map, v);
  4. Object refreshToken = map.get(getTCK().refreshToken());
  5. if (refreshToken != null) {
  6. if (refreshToken instanceof RefreshToken) {
  7. st.setRefreshToken((RefreshToken) refreshToken);
  8. } else {
  9. st.setRefreshToken(getTF2().getRefreshToken(refreshToken.toString()));
  10. }
  11. }
  12. st.setRefreshTokenValid(map.getBoolean(getTCK().refreshTokenValid()));
  13. st.setRefreshTokenLifetime(map.getLong(getTCK().expiresIn()));
  14. st.setCallback(map.getURI(getTCK().callbackUri()));
  15. st.setNonce(map.getString(getTCK().nonce()));
  16. if (map.get(getTCK().scopes()) != null) {
  17. net.sf.json.JSONArray json = (JSONArray) JSONSerializer.toJSON(map.get(getTCK().scopes()));
  18. Collection<String> zzz = (Collection<String>) JSONSerializer.toJava(json);
  19. st.setScopes(zzz);
  20. }
  21. if (map.get(getTCK().authTime()) != null) {
  22. st.setAuthTime(map.getDate(getTCK().authTime));
  23. }
  24. if (map.get(getTCK().states()) != null) {
  25. st.setState((JSONObject) JSONSerializer.toJSON(map.get(getTCK().states())));
  26. } else {
  27. st.setState(new JSONObject());
  28. }
  29. return st;
  30. }

代码示例来源:origin: itesla/ipst

  1. public static String contingenciesIdsToJson(Collection<String> contingenciesIds) {
  2. return JSONSerializer.toJSON(contingenciesIds).toString();
  3. }

代码示例来源:origin: itesla/ipst

  1. public static String indexesDataToJson(Map<String, Boolean> indexesData) {
  2. return JSONSerializer.toJSON(indexesData).toString();
  3. }

相关文章