/** * Use {@link #parse(String)} instead. * * @param s The JSON object string to parse. Must not be {@code null}. * * @return The JSON object. * * @throws ParseException If the string cannot be parsed to a valid JSON * object. */ @Deprecated public static JSONObject parseJSONObject(final String s) throws ParseException { return parse(s); }
/** * Parses the specified string representing a JSON Web Key (JWK) set. * * @param s The string to parse. Must not be {@code null}. * * @return The JWK set. * * @throws ParseException If the string couldn't be parsed to a valid * JSON Web Key (JWK) set. */ public static JWKSet parse(final String s) throws ParseException { return parse(JSONObjectUtils.parse(s)); }
/** * Parses a JWE header from the specified JSON object string. * * @param jsonString The JSON object string to parse. Must not be {@code null}. * * @return The JWE header. * * @throws ParseException If the specified JSON object string doesn't * represent a valid JWE header. */ public static JWEHeader parse(final String jsonString) throws ParseException { return parse(JSONObjectUtils.parse(jsonString), null); }
/** * Parses a public / private Octet Key Pair JWK from the specified JSON * object string representation. * * @param s The JSON object string to parse. Must not be {@code null}. * * @return The public / private Octet Key Pair JWK. * * @throws ParseException If the string couldn't be parsed to an Octet * Key Pair JWK. */ public static OctetKeyPair parse(final String s) throws ParseException { return parse(JSONObjectUtils.parse(s)); }
/** * Parses a public / private Elliptic Curve JWK from the specified JSON * object string representation. * * @param s The JSON object string to parse. Must not be {@code null}. * * @return The public / private Elliptic Curve JWK. * * @throws ParseException If the string couldn't be parsed to an * Elliptic Curve JWK. */ public static ECKey parse(final String s) throws ParseException { return parse(JSONObjectUtils.parse(s)); }
/** * Parses a public / private RSA JWK from the specified JSON object * string representation. * * @param s The JSON object string to parse. Must not be {@code null}. * * @return The public / private RSA JWK. * * @throws ParseException If the string couldn't be parsed to an RSA * JWK. */ public static RSAKey parse(final String s) throws ParseException { return parse(JSONObjectUtils.parse(s)); }
/** * Parses a JWK from the specified JSON object string representation. * The JWK must be an {@link ECKey}, an {@link RSAKey}, or a * {@link OctetSequenceKey}. * * @param s The JSON object string to parse. Must not be {@code null}. * * @return The JWK. * * @throws ParseException If the string couldn't be parsed to a * supported JWK. */ public static JWK parse(final String s) throws ParseException { return parse(JSONObjectUtils.parse(s)); }
/** * Parses a JWE header from the specified JSON object string. * * @param jsonString The JSON string to parse. Must not be * {@code null}. * @param parsedBase64URL The original parsed Base64URL, {@code null} * if not applicable. * * @return The JWE header. * * @throws ParseException If the specified JSON object string doesn't * represent a valid JWE header. */ public static JWEHeader parse(final String jsonString, final Base64URL parsedBase64URL) throws ParseException { return parse(JSONObjectUtils.parse(jsonString), parsedBase64URL); }
/** * Parses a JSON Web Token (JWT) claims set from the specified JSON * object string representation. * * @param s The JSON object string to parse. Must not be {@code null}. * * @return The JWT claims set. * * @throws ParseException If the specified JSON object string doesn't * represent a valid JWT claims set. */ public static JWTClaimsSet parse(final String s) throws ParseException { return parse(JSONObjectUtils.parse(s)); } }
/** * Parses an octet sequence JWK from the specified JSON object string * representation. * * @param s The JSON object string to parse. Must not be {@code null}. * * @return The octet sequence JWK. * * @throws ParseException If the string couldn't be parsed to an octet * sequence JWK. */ public static OctetSequenceKey parse(final String s) throws ParseException { return parse(JSONObjectUtils.parse(s)); }
/** * Parses an unsecured header from the specified JSON string. * * @param jsonString The JSON string to parse. Must not be * {@code null}. * @param parsedBase64URL The original parsed Base64URL, {@code null} * if not applicable. * * @return The unsecured header. * * @throws ParseException If the specified JSON string doesn't * represent a valid unsecured header. */ public static PlainHeader parse(final String jsonString, final Base64URL parsedBase64URL) throws ParseException { return parse(JSONObjectUtils.parse(jsonString), parsedBase64URL); }
/** * Parses a JWS header from the specified JSON object string. * * @param jsonString The JSON string to parse. Must not be * {@code null}. * @param parsedBase64URL The original parsed Base64URL, {@code null} * if not applicable. * * @return The JWS header. * * @throws ParseException If the specified JSON object string doesn't * represent a valid JWS header. */ public static JWSHeader parse(final String jsonString, final Base64URL parsedBase64URL) throws ParseException { return parse(JSONObjectUtils.parse(jsonString), parsedBase64URL); }
/** * Returns a JSON object representation of this payload. * * @return The JSON object representation, {@code null} if the payload * couldn't be converted to a JSON object. */ public JSONObject toJSONObject() { if (jsonObject != null) { return jsonObject; } // Convert String s = toString(); if (s == null) { // to string conversion failed return null; } try { return JSONObjectUtils.parse(s); } catch (ParseException e) { // Payload not a JSON object return null; } }
/** * Parses a {@link PlainHeader}, {@link JWSHeader} or {@link JWEHeader} * from the specified JSON object string. * * @param jsonString The JSON object string to parse. Must not be * {@code null}. * @param parsedBase64URL The original parsed Base64URL, {@code null} * if not applicable. * * @return The header. * * @throws ParseException If the specified JSON object string doesn't * represent a valid header. */ public static Header parse(final String jsonString, final Base64URL parsedBase64URL) throws ParseException { JSONObject jsonObject = JSONObjectUtils.parse(jsonString); return parse(jsonObject, parsedBase64URL); }
jsonObject = JSONObjectUtils.parse(res.getContent()); } catch (ParseException e) { throw new IllegalStateException("Couldn't parse remote metadata: " + e.getMessage(), e);
jsonObject = JSONObjectUtils.parse(header.decodeToString());
jsonObject = JSONObjectUtils.parse(parts[0].decodeToString());