Package com.nimbusds.jose.util
Class JSONArrayUtils
java.lang.Object
com.nimbusds.jose.util.JSONArrayUtils
JSON array helper methods.
- Version:
- 2024-11-14
- Author:
- Toma Velev, Vladimir Dzhuvinov
-
Method Summary
Modifier and TypeMethodDescriptionCreates a new JSON array.Parses a JSON array.static StringtoJSONString(List<?> jsonArray) Serialises the specified list to a JSON array using the entity mapping specified inparse(String).
-
Method Details
-
parse
Parses a JSON array.Specific JSON to Java entity mapping (as per JSON Smart):
- JSON true|false map to
java.lang.Boolean. - JSON numbers map to
java.lang.Number.- JSON integer numbers map to
long. - JSON fraction numbers map to
double.
- JSON integer numbers map to
- JSON strings map to
java.lang.String. - JSON arrays map to
java.util.List<Object>. - JSON objects map to
java.util.Map<String,Object>.
- Parameters:
s- The JSON array string to parse. Must not benull.- Returns:
- The JSON object.
- Throws:
ParseException- If the string cannot be parsed to a valid JSON object.
- JSON true|false map to
-
toJSONString
Serialises the specified list to a JSON array using the entity mapping specified inparse(String).- Parameters:
jsonArray- The JSON array. Must not benull.- Returns:
- The JSON array as string.
-
newJSONArray
Creates a new JSON array.- Returns:
- The new empty JSON array.
-