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

Invalid json generated if table key is number #65

Open
inv2004 opened this issue Mar 16, 2023 · 1 comment · May be fixed by #67
Open

Invalid json generated if table key is number #65

inv2004 opened this issue Mar 16, 2023 · 1 comment · May be fixed by #67

Comments

@inv2004
Copy link

inv2004 commented Mar 16, 2023

Code:

import jsony, tables
let t = {100: "aaa"}.toTable
echo t.toJson

Actual:

{100:"aaa"}

^^^ json key uses quotes

Expected:

{"100":"aaa"}
@pietroppeter
Copy link
Contributor

Probably the fix is to replace this dumpHook with a dumpKey:

s.dumpHook(k)

inv2004 added a commit to inv2004/jsony that referenced this issue Mar 17, 2023
@inv2004 inv2004 linked a pull request Mar 17, 2023 that will close this issue
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 a pull request may close this issue.

2 participants