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

std.json5 #8875

Closed
wants to merge 6 commits into from
Closed

std.json5 #8875

wants to merge 6 commits into from

Conversation

quickfur
Copy link
Member

@quickfur quickfur commented Jan 4, 2024

This is a rebase of #8806 on master, and rename of std.json to std.json5 while restoring the original std.json, as requested by reviewers.

@dlang-bot
Copy link
Contributor

Thanks for your pull request, @quickfur!

Bugzilla references

Your PR doesn't reference any Bugzilla issue.

If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub run digger -- build "master + phobos#8875"

@schveiguy
Copy link
Member

schveiguy commented Jan 4, 2024

I would not want to merge this, for the same reasons as stated before

This belongs in a dub package.

@quickfur
Copy link
Member Author

quickfur commented Jan 4, 2024

Oh I see. Nevermind then.

@quickfur quickfur closed this Jan 4, 2024
@Herringway
Copy link
Contributor

This belongs in a dub package.

The same can be said of std.json. If we're going to commit to maintaining a mistake, shouldn't it be done in the name of user-friendliness?

@schveiguy
Copy link
Member

The same can be said of std.json.

I don't disagree. The fact that this list is so long is evidence that std.json just isn't enough: https://code.dlang.org/search?q=json

But note that even on top of that, this module is much less comprehensive than even std.json -- it basically provides no mechanism to properly serialize json5, nor does it tell you the original format of the thing that you deserialized.

I think dub is the right place for these kinds of projects. It's unfortunate that std.json isn't already there, and I don't know if we'll ever move it.

@CyberShadow
Copy link
Member

But note that even on top of that, this module is much less comprehensive than even std.json -- it basically provides no mechanism to properly serialize json5,

Wouldn't you just use regular JSON for serialization? Since it's a subset of JSON5, it will be compatible.

@schveiguy
Copy link
Member

schveiguy commented Jan 5, 2024

Yes, if you don't care about removing comments, changing how people have put in numbers, etc.

If you are just parsing, then it might be OK. But writing out the data you should have options if you support json5.

A single public function like JSONValue parseJSON5(R)(R inputrange) might be acceptable in phobos.

@CyberShadow
Copy link
Member

Yes, if you don't care about removing comments

I think the general expectation is that parsers throw away comments, and don't preserve the exact representation (e.g. which string literal syntax was used).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants