Skip to content

std/json does not support json5 #1265

Description

@soyuta

.luaurc is JSON5, but lute setup --with-luaurc fails whenever the file contains trailing commas or comments.

{
    "languageMode": "strict", 
}
> lute --version          
1.0.0

> lute setup --with-luaurc
Writing definitions at ~/.lute/typedefs/1.0.0
Successfully wrote type definition files to ~/.lute/typedefs/1.0.0
Writing luaurc file at path\to\.luaurc
@std/json.luau:231: JSON error - Trailing comma around 34
stacktrace:
[C] function error
@std/json.luau:231 function deserializerError
@std/json.luau:484 function deserializeObject
@std/json.luau:518
@std/json.luau:549 function deserialize
@cli/setup/init.luau:61

There is still no option like --with-config-luau, either, so it is difficult to include comments in the configuration.

However, this does not seem like a simple bug, since the issue occurs because @lute/json only parses standard JSON. Perhaps @lute/json should provide an option to parse JSONC as well.

Considering that not only .luaurc, but also Rojo’s .json files, use JSONC that is closer to JSON5, supporting only strict JSON may be limiting.
of course, if the goal is to keep the library small, it would also be reasonable for it to support only standard JSON

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestgood first issueGood for newcomersstdWork in the Luau standard library portion of the code

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions