Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expected quotation mark '"', but had '"' instead at path #2399

Closed
nbransby opened this issue Aug 5, 2023 · 7 comments
Closed

Expected quotation mark '"', but had '"' instead at path #2399

nbransby opened this issue Aug 5, 2023 · 7 comments

Comments

@nbransby
Copy link

nbransby commented Aug 5, 2023

I did want to goggle for the exact error message before I posted an issue but I couldn't because it has quotes in it so surrounding it in quotes in google doesn't help!

Caused by: kotlinx.serialization.json.internal.JsonDecodingException: Unexpected JSON token at offset 4054: Expected quotation mark '"', but had '"' instead at path: $.isFork
JSON input: .....07-28T21:06:29Z","updated_at":"2022-11-04T13:28
at kotlinx.serialization.json.internal.JsonExceptionsKt.JsonDecodingException(JsonExceptions.kt:24)
at kotlinx.serialization.json.internal.JsonExceptionsKt.JsonDecodingException(JsonExceptions.kt:32)
at kotlinx.serialization.json.internal.AbstractJsonLexer.fail(AbstractJsonLexer.kt:584)
at kotlinx.serialization.json.internal.AbstractJsonLexer.fail$default(AbstractJsonLexer.kt:582)
at kotlinx.serialization.json.internal.AbstractJsonLexer.fail$kotlinx_serialization_json(AbstractJsonLexer.kt:223)
at kotlinx.serialization.json.internal.StringJsonLexer.consumeKeyString(StringJsonLexer.kt:88)
at kotlinx.serialization.json.internal.AbstractJsonLexer.consumeString(AbstractJsonLexer.kt:369)
at kotlinx.serialization.json.internal.AbstractJsonLexer.consumeStringLenient(AbstractJsonLexer.kt:449)
at kotlinx.serialization.json.internal.AbstractJsonLexer.skipElement(AbstractJsonLexer.kt:534)
at kotlinx.serialization.json.internal.StreamingJsonDecoder.handleUnknown(StreamingJsonDecoder.kt:250)
at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeObjectIndex(StreamingJsonDecoder.kt:240)
at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeElementIndex(StreamingJsonDecoder.kt:175)
at dev.gitlive.internal.service.Repository$$serializer.deserialize(Repository.kt:8)
at dev.gitlive.internal.service.Repository$$serializer.deserialize(Repository.kt:8)
at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:70)
at kotlinx.serialization.json.Json.decodeFromString(Json.kt:107)
at io.ktor.serialization.kotlinx.KotlinxSerializationConverter.deserialize(KotlinxSerializationConverter.kt:82)
... 39 more

Environment

  • Kotlin version: 1.8.22
  • Library version: 1.3.2
  • Kotlin platforms: JVM
  • Gradle version: 7.6
@sandwwraith
Copy link
Member

Error message is indeed incorrect (probably related to #2360), but I can't say for sure what is wrong with your input. Probably some unquoted value that should be quoted. Try to look at the specified offset (4054) or turn on lenient mode.

@sandwwraith
Copy link
Member

(It would also be helpful if you provide an actual input after finding the issue)

@nbransby
Copy link
Author

nbransby commented Aug 7, 2023

This was with lenient mode on, can't seem to reproduce it either

@sandwwraith
Copy link
Member

Also try to update serialization runtime, as 1.3.2 is a kinda of an old release — incorrect message may have already been fixed.

sandwwraith added a commit that referenced this issue Aug 8, 2023
To avoid cryptic and incorrect ones, such as `Expected quotation mark '"', but had '"' instead`.

Fixes #2360
Fixes #2399
sandwwraith added a commit that referenced this issue Aug 9, 2023
To avoid cryptic and incorrect ones, such as `Expected quotation mark '"', but had '"' instead` or `unexpected token: 10`.

Fixes #2360
Fixes #2399

Also remove @PublishedApi from BATCH_SIZE to remove it from public API dump.
@imtianx
Copy link

imtianx commented Aug 9, 2023

I got the similar problem when i parsed the number to String :

Expected quotation mark '"', but had '2' instead at path:

I want to use String to parse all numbers, is now supported ?

@nbransby
Copy link
Author

nbransby commented Aug 9, 2023

@imtianx have you turned on lenient mode?

@imtianx
Copy link

imtianx commented Aug 9, 2023

@imtianx have you turned on lenient mode?

Thanks, open the lenient can parse.

sandwwraith added a commit that referenced this issue Aug 11, 2023
To avoid cryptic and incorrect ones, such as `Expected quotation mark '"', but had '"' instead` or `unexpected token: 10`.

Fixes #2360
Fixes #2399

Also remove @PublishedApi from BATCH_SIZE to remove it from public API dump.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants