Package org.apache.felix.utils.json
Class JSONParser
java.lang.Object
org.apache.felix.utils.json.JSONParser
A very small JSON parser.
The JSON input is parsed into an object structure in the following way:
- Object names are represented as a
String
. - String values are represented as a
String
. - Numeric values without a decimal separator are represented as a
Long
. - Numeric values with a decimal separator are represented as a
Double
. - Boolean values are represented as a
Boolean
. - Nested JSON objects are parsed into a
Map<String, Object>
. - JSON lists are parsed into a
List
which may contain any of the above values.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static class
private static enum
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static JSONParser.Pair
<String, Object> parseKeyValue
(String jsonKeyValue) parseKeyValueListRaw
(String jsonKeyValueList) parseListValuesRaw
(String jsonList) private static Object
parseObject
(String jsonObject) private static Object
parseValue
(String jsonValue) private static byte[]
Read an entire input stream into a byte array.private static String
private static String
-
Field Details
-
KEY_VALUE_PATTERN
-
parsed
-
-
Constructor Details
-
JSONParser
-
JSONParser
- Throws:
IOException
-
-
Method Details
-
getParsed
-
getParsedList
-
parseKeyValue
-
parseValue
-
unEscapeString
-
parseObject
-
parseKeyValueListRaw
-
parseListValuesRaw
-
readStream
Read an entire input stream into a byte array.- Parameters:
is
- The input stream to read.- Returns:
- The byte array with the contents of the input stream.
- Throws:
IOException
- if the underlying read operation on the input stream throws an error.
-
readStreamAsString
- Throws:
IOException
-