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

feat: the Stringer implements in JSON mode #59

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tyrzhang
Copy link

feat: the Stringer implements in JSON mode

output string example:

{"size":1,"depth":3,"root":{"entries":[{"bb":"[1.00, 2.00]x[1.00, 2.00]","child":{"entries":[{"bb":"[1.00, 2.00]x[1.00, 2.00]","child":{"leaf":true,"entries":[{"bb":"[1.00, 2.00]x[1.00, 2.00]"}]}}]}}]}}

format the example

{
  "size": 1,
  "depth": 3,
  "root": {
    "entries": [
      {
        "bb": "[1.00, 2.00]x[1.00, 2.00]",
        "child": {
          "entries": [
            {
              "bb": "[1.00, 2.00]x[1.00, 2.00]",
              "child": {
                "leaf": true,
                "entries": [
                  {
                    "bb": "[1.00, 2.00]x[1.00, 2.00]"
                  }
                ]
              }
            }
          ]
        }
      }
    ]
  }
}

@tyrzhang tyrzhang force-pushed the feature/tyr_stringer branch from c82c13e to 1b087de Compare December 20, 2024 02:43
@tyrzhang tyrzhang force-pushed the feature/tyr_stringer branch from 1b087de to 713c8c0 Compare December 20, 2024 02:48
@dhconnelly
Copy link
Owner

People will start relying on the fact that the string representation is JSON. (Conway's Law :)) Could you add a test case to verify it will parse properly? A small but nontrivial tree should be sufficient.

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

Successfully merging this pull request may close these issues.

2 participants