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

Small error in documentation of JsonPrimitive.isString #2863

Open
gekylafas opened this issue Nov 20, 2024 · 1 comment
Open

Small error in documentation of JsonPrimitive.isString #2863

gekylafas opened this issue Nov 20, 2024 · 1 comment
Assignees

Comments

@gekylafas
Copy link

Describe the bug
In https://github.com/Kotlin/kotlinx.serialization/blame/31ab68caec3a448e1485f0d924106044fef112a7/formats/json/commonMain/src/kotlinx/serialization/json/JsonElement.kt#L39 and above it says:

    /**
     * Indicates whether the primitive was explicitly constructed from [String] and
     * whether it should be serialized as one. E.g. `JsonPrimitive("42")` is represented
     * by a string, while `JsonPrimitive(42)` is not.
     * These primitives will be serialized as `42` and `"42"` respectively.
     */

I believe the serialization examples should be the other way around, i.e. "...as "42" and 42 respectively".

@sandwwraith
Copy link
Member

Yeah, I think you're right, thanks for heads-up!

sandwwraith added a commit that referenced this issue Nov 21, 2024
correctly quote primitives

Fixes #2863
sandwwraith added a commit that referenced this issue Nov 21, 2024
@sandwwraith sandwwraith self-assigned this Nov 27, 2024
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

2 participants