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

Issues with JSON utilities #3

Open
astoff opened this issue Jun 18, 2020 · 0 comments
Open

Issues with JSON utilities #3

astoff opened this issue Jun 18, 2020 · 0 comments

Comments

@astoff
Copy link

astoff commented Jun 18, 2020

I have encountered some issues with the json routines. The following lua file

kpse.set_program_name("luatex")
require "lualibs"

inspect("array", utilities.json.tojson({[1] = 0}))
inspect("object", utilities.json.tojson({a = 0}))

generates

array
[
 0
]
object
{
 "a" : "0"
}

The object should be {"a": 0} here.

Second, the script

kpse.set_program_name("luatex")
require "lualibs"
utilities.json.tojson(0)

crashes with the following message:

...exmf-dist/tex/luatex/lualibs/lualibs-extended-merged.lua:3076: bad argument #1 to 'lpegmatch' (lpeg-pattern expected, got nil)

Finally, it would be important for the JSON encoder to be able to produce null values when needed (and perhaps for the decoder not to translate JSON nulls into Lua nils, at least if requested by the user). This could be done by checking for a special value utilities.json.null.

Lastly, it would be nice to be able to generate compact JSONs without additional blank spaces.

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

No branches or pull requests

1 participant