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

Change how toJSON works #3208

Closed
1 task done
TracerDS opened this issue Oct 13, 2023 · 1 comment
Closed
1 task done

Change how toJSON works #3208

TracerDS opened this issue Oct 13, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@TracerDS
Copy link
Contributor

Is your feature request related to a problem? Please describe.

Currently toJSON will return json encoded string additionally wrapped in an array. That can cause troubles and you have to manually remove the array by doing substring on the string.

Describe the solution you'd like

It would be best if toJSON returned valid values;
for this code

local tbl = { 1, 2, 3, 4 }

iprint(toJSON(tbl))

toJSON should return [ 1, 2, 3, 4 ]

For this code

local tbl = { key = 'value', [1] = 12, ['pi'] = 3.14 }

iprint(toJSON(tbl))

toJSON should return { "1": 12, "key": "value", "pi": 3.14 } and not [ { "1": 12, "key": "value", "pi": 3.14 } ]

Describe alternatives you've considered

No response

Additional context

No response

Security Policy

  • I have read and understood the Security Policy and this issue is not about a cheat or security vulnerability.
@TracerDS TracerDS added the enhancement New feature or request label Oct 13, 2023
@Fernando-A-Rocha
Copy link
Contributor

same as #1073

@TracerDS TracerDS closed this as not planned Won't fix, can't repro, duplicate, stale Oct 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants