private String getStringValue( Object jo ) { String nodevalue = null; if ( jo != null ) { if ( jo instanceof Map ) { @SuppressWarnings( "unchecked" ) Map<String, ?> asStrMap = (Map<String, ?>) jo; nodevalue = JSONObject.toJSONString( asStrMap ); } else { nodevalue = jo.toString(); } } return nodevalue; }
@Override public String toJson(Object obj) { if (obj instanceof Map) { return JSONObject.toJSONString((Map<String, ?>) obj, JSONStyle.LT_COMPRESS); } else if (obj instanceof List) { return JSONArray.toJSONString((List<?>) obj, JSONStyle.LT_COMPRESS); } else { throw new UnsupportedOperationException(obj.getClass().getName() + " can not be converted to JSON"); } }
if (response.get("status").equals("error")) { throw new RuntimeException("command " + url + " with body " + body + " failed " + JSONObject.toJSONString(response));
if (!response.get("failed").equals(0)) { throw new RuntimeException("url " + url + " with body " + body + " failed " + JSONObject.toJSONString(response));
@Override public String toJson(Object obj) { if (obj instanceof Map) { return JSONObject.toJSONString((Map<String, ?>) obj, JSONStyle.LT_COMPRESS); } else if (obj instanceof List) { return JSONArray.toJSONString((List<?>) obj, JSONStyle.LT_COMPRESS); } else { throw new UnsupportedOperationException(obj.getClass().getName() + " can not be converted to JSON"); } }
break; case JWKS: newClient.setJwks(JWKSet.parse(claimSet.getJSONObjectClaim(claim).toJSONString())); break; case POLICY_URI:
break; case JWKS: newClient.setJwks(JWKSet.parse(claimSet.getJSONObjectClaim(claim).toJSONString())); break; case POLICY_URI:
/** * @see stream.DataProcessor#process(stream.Data) */ @Override public Data processMatchingData(Data data) { if (data == null) return null; String json = JSONObject.toJSONString(data); System.out.println(json); return data; } }
/** * @see stream.DataProcessor#process(stream.Data) */ @Override public Data processMatchingData(Data data) { if (data == null) return null; String json = JSONObject.toJSONString(data); System.out.println(json); return data; } }
/** * @see stream.DataProcessor#process(stream.Data) */ @Override public Data processMatchingData(Data data) { if (data == null) return null; String json = JSONObject.toJSONString(data); System.out.println(json); return data; } }
public static String convert(String yamlString) { Yaml yaml = new Yaml(); log.debug("Try to load yaml string: " + yamlString); Map<String, ?> load = yaml.load(yamlString); return JSONObject.toJSONString(load); } }
/** * @see stream.Processor#process(stream.Data) */ @Override public Data process(Data input) { String json = JSONObject.toJSONString(input); input.put(key, json); return input; } }
@Override public String toString() { return toJSONObject().toJSONString(); }
/** * Serialize an object to a string. * * @param o the object to serialize * @return the JSON message * @throws JSONConverterException if an error occurred while converting the object */ default String toJSONString(E o) throws JSONConverterException { return toJSON(o).toJSONString(); } }
@GetMapping(produces={MediaType.APPLICATION_JSON_VALUE}) @ApiOperation(value = "Read server public keys", response=JWKSet.class, notes = "Fetches publick keys of the target server. Keys are used to encrypt data sent to the server and also send a response encrytpion key to the server. See RFC7800") @ApiResponses(value = { @ApiResponse(code = 200, message = "Ok")}) public ResponseEntity<String> getPublicKeys(){ JWKSet publicKeys = popService.getPublicKeys(); return ResponseEntity.ok(publicKeys.toJSONObject().toJSONString()); } }
@SuppressWarnings("unchecked") private String stringifyJSONObject(Object obj) { if (obj instanceof Map) { return new JSONObject((Map<String, ?>) obj).toJSONString(); } if (obj instanceof JSONArray) { return ((JSONArray)obj).toJSONString(); } return obj == null ? "" : obj.toString(); //$NON-NLS-1$ }
/** * Helper function that serializes a SerializableEntity to a byte array. * * @param entity The entity to serialize. * @return The resulting byte array. */ public static byte[] serializeToBytes(final SerializableEntity entity) { return StringEncoder.getBytes(serializeToJson(entity).toJSONString()); } }
public LoginSessionEntity(LoginSessionToken token, UserInfo userInfo) { this.id = token.getValue(); this.userInfo = userInfo.toJSONObject().toJSONString(); this.valid = true; }
@Override public String getClaims() { String c = null; JWTClaimsSet claims = null; try { claims = jwt.getJWTClaimsSet(); c = claims.toJSONObject().toJSONString(); } catch (ParseException e) { log.unableToParseToken(e); } return c; }
public AuthCodeEntity(AuthorizationCode code, UserInfo userInfo, ClientID clientId, LoginSessionToken sessionId, URI redirectUri) { this.id = code.getValue(); if (userInfo != null) { this.userInfo = userInfo.toJSONObject().toJSONString(); } this.clientId = clientId.getValue(); this.loginSession = sessionId != null ? sessionId.getValue() : null; this.redirectUri = redirectUri != null ? redirectUri.toString() : null; }