Skip to content

Unquoted strings starting with non-string token do not strictly preserve its original content #61

@andjsrk

Description

@andjsrk

Description

Currently, the parser parses numbers immediately in tokenization step then stringifies them again when it turns out to be part of an unquoted string. This should probably be changed to store a string and parse only when it really is a number, in parsing step.

Reproduction Steps

  1. Call the decoder with:
    Case 1:
    a: 1.0 b
    
    Case 2:
    a: 1e1 b
    
  2. Observe the output.

Expected Behavior

Case 1: Parsed to { "a": "1.0 b" } (JSON for convenience)
Case 2: Parsed to { "a": "1e1 b" } (JSON for convenience)

Actual Behavior

Case 1: Parsed to { "a": "1 b" } (JSON for convenience)
Case 2: Parsed to { "a": "10 b" } (JSON for convenience)

Environment

  • Package version: 0.4.4
  • Runtime: Rust 1.96.0 (nightly)
  • OS: Windows 11

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions