GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Extra " when calling MessagePackSerializer.ToJson · Issue #1473 · MessagePack-CSharp/MessagePack-CSharp

Extra " when calling MessagePackSerializer.ToJson #1473

New issue
Copy link
New issue
Copy link
Closed
#1490
Closed
Extra " when calling MessagePackSerializer.ToJson#1473
#1490
Copy link
Assignees
ImanNavidi
Labels
buggood first issue
Milestone
v2.4

Description

@jiatao99
jiatao99
opened on Jul 28, 2022
Issue body actions

There is an extra " when calling MessagePackSerializer.ConvertToJson for extension code of 100 (typeless)

In MessagePackSerializer.Json.cs at line 435

writer.Write("{\"$type\":\"" + typeNameTokenBuilder.ToString() + "}");

There is an extra " if after type (when no data after type). This will breaks the JSON format. Should be:

writer.Write("{\"$type\":" + typeNameTokenBuilder.ToString() + "}");

Cheers
Tao

Activity

  1. AArnott commented on Jul 28, 2022

    @AArnott
    AArnott
    on Jul 28, 2022
    Collaborator
    More actions

    Nice catch, @jiatao99. But rather than an extra, wouldn't we say there's one missing?

    With you proposed fix, it appears we might generate this JSON: "$type":someTypeName When that's missing quotes. Shouldn't it be "$type":"someTypeName"?

  2. jiatao99 commented on Jul 28, 2022

    @jiatao99
    jiatao99
    on Jul 28, 2022
    Author
    More actions

    Here is the output:

    {"column1":[{"value1":[{"$type":""System.Decimal"},"1.001"]}],"column2":[{"value2":[null,"text"]}]}
    

    see {"$type":""System.Decimal"} the problem is :""String.Decimal"

    whenever you use TypelessFormatter without write anything out in your own formatter, it output "" after :

  3. AArnott commented on Jul 28, 2022

    @AArnott
    AArnott
    on Jul 28, 2022
    Collaborator
    More actions

    Oh, so typeNameTokenBuilder.ToString() must emit the surrounding quotes itself. Nice find.

    Wanna send the PR?

  4. AArnott
    added
    bug
    good first issue
    on Jul 28, 2022
  5. ImanNavidi commented on Aug 24, 2022

    @ImanNavidi
    ImanNavidi
    on Aug 24, 2022
    Contributor
    More actions

    I would be happy to send the PR if no one else has done it yet

    Reacted by Andrew Arnott
  6. AArnott
    assigned
    ImanNavidi
    on Aug 25, 2022
  7. AArnott commented on Aug 25, 2022

    @AArnott
    AArnott
    on Aug 25, 2022
    Collaborator
    More actions

    Thank you, @ImanNavidi

  8. AArnott
    linked a pull request that will close this issueremoving extra double quotation mark #1490on Aug 25, 2022
  9. AArnott
    closed this as completedon Aug 25, 2022
  10. AArnott
    added this to the v2.4 milestone on Aug 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @ImanNavidi
    ImanNavidi

Labels

buggood first issue

Type

No type

Projects

No projects

    Milestone

    • v2.4

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.