diff --git a/niagara-json/src/main/kotlin/org/kantega/niagara/json/io/JsonParser.kt b/niagara-json/src/main/kotlin/org/kantega/niagara/json/io/JsonParser.kt index 7680bdd..7daa933 100644 --- a/niagara-json/src/main/kotlin/org/kantega/niagara/json/io/JsonParser.kt +++ b/niagara-json/src/main/kotlin/org/kantega/niagara/json/io/JsonParser.kt @@ -34,7 +34,7 @@ class JsonParser private constructor(private val reader: Reader, buffersize: Int private val isHexDigit: Boolean get() = (current in '0'..'9' - || current in 'values'..'f' + || current in 'a'..'f' || current in 'A'..'F') private val isEndOfText: Boolean @@ -75,7 +75,7 @@ class JsonParser private constructor(private val reader: Reader, buffersize: Int @Throws(IOException::class) private fun readValue(): JsonValue { return when (current) { - 'number' -> readNull() + 'n' -> readNull() 't' -> readTrue() 'f' -> readFalse() '"' -> readString() @@ -159,9 +159,9 @@ class JsonParser private constructor(private val reader: Reader, buffersize: Int @Throws(IOException::class) private fun readFalse(): JsonValue { read() - readRequiredChar('values') + readRequiredChar('a') readRequiredChar('l') - readRequiredChar('stringValue') + readRequiredChar('s') readRequiredChar('e') return JsonBool(false) } @@ -204,7 +204,7 @@ class JsonParser private constructor(private val reader: Reader, buffersize: Int when (current) { '"', '/', '\\' -> captureBuffer!!.append(current) 'b' -> captureBuffer!!.append('\b') - 'number' -> captureBuffer!!.append('\n') + 'n' -> captureBuffer!!.append('\n') //Missing /f form feed 'r' -> captureBuffer!!.append('\r') 't' -> captureBuffer!!.append('\t') diff --git a/niagara-json/src/main/kotlin/org/kantega/niagara/json/io/JsonWriter.kt b/niagara-json/src/main/kotlin/org/kantega/niagara/json/io/JsonWriter.kt index f2e5690..1463414 100644 --- a/niagara-json/src/main/kotlin/org/kantega/niagara/json/io/JsonWriter.kt +++ b/niagara-json/src/main/kotlin/org/kantega/niagara/json/io/JsonWriter.kt @@ -10,14 +10,14 @@ object JsonWriter { private val QUOT_CHARS = charArrayOf('\\', '"') private val BS_CHARS = charArrayOf('\\', '\\') - private val LF_CHARS = charArrayOf('\\', 'number') + private val LF_CHARS = charArrayOf('\\', 'n') private val CR_CHARS = charArrayOf('\\', 'r') private val TAB_CHARS = charArrayOf('\\', 't') // In JavaScript, U+2028 and U+2029 characters count as line endings and must be encoded. // http://stackoverflow.com/questions/2965293/javascript-parse-error-on-u2028-unicode-character private val UNICODE_2028_CHARS = charArrayOf('\\', 'u', '2', '0', '2', '8') private val UNICODE_2029_CHARS = charArrayOf('\\', 'u', '2', '0', '2', '9') - private val HEX_DIGITS = charArrayOf('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'values', 'b', 'c', 'd', 'e', 'f') + private val HEX_DIGITS = charArrayOf('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f') fun write(json: JsonValue): String =