Re: [go-nuts] Re: When will the official encoding/json package support parsing json5?

2022-03-20 Thread Nigel Tao
On Mon, Mar 21, 2022 at 6:00 AM jan.f...@gmail.com 
wrote:

> Just googled for "json5 golang" and there seem to be several 3rd party
> implementations available.
> Can you not use one of those?


See also HuJSON, also known as "JSON With Commas and Comments":
https://github.com/tailscale/hujson
https://nigeltao.github.io/blog/2021/json-with-commas-comments.html

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAOeFMNXrpVcBe4j-cnJTHq8EaXjdhPxNyT0No-m26ksD9xio%2Bw%40mail.gmail.com.


[go-nuts] Re: When will the official encoding/json package support parsing json5?

2022-03-20 Thread jan.f...@gmail.com
Just googled for "json5 golang" and there seem to be several 3rd party 
implementations available.
Can you not use one of those?

söndag 20 mars 2022 kl. 14:27:05 UTC skrev Brian Candler:

> If you're going down that route, you could also consider jsonnet 
>  (which does have a Go implementation 
> )
>
> It will almost certainly be much more powerful than you need, but it *is* 
> another superset of JSON which includes comments.
>
> On Sunday, 20 March 2022 at 13:16:20 UTC christoph...@gmail.com wrote:
>
>> You might want to try qjson that I wrote a year ago (
>> https://github.com/qjson). 
>> It's basically just one function that converts qjson text into json. 
>> Qjson is inspired by hjson, but extend it in many ways. 
>> It is convenient for config files. 
>>
>> Maybe I extend it a bit too far by supporting unquoted strings or single 
>> quoted strings. Lol
>>
>>
>> Le samedi 19 mars 2022 à 01:03:17 UTC+1, ben...@gmail.com a écrit :
>>
>>> Yeah, Go's encoding/json will almost certainly never support json5. 
>>> However, one very simple approach: if you're using JSON for a config file 
>>> and just need ability to add // line comments, you can just write a simple 
>>> transformer which reads the file line by line and filters out lines that 
>>> start with "//" (optionally preceded by whitespace), and then send the 
>>> result to encoding/json.
>>>
>>> On Friday, March 18, 2022 at 1:59:21 PM UTC+13 r...@rwx.gg wrote:
>>>
 It is my sincere hope that Go will never support anything as poorly 
 designed as JSON5, using reflection is already slow enough. Comments were 
 never intended for JSON and never should be added, ever. But since most 
 discerning development shops are moving to Protobuf for everything that 
 matters, perhaps that would be less of a problem.

 On Monday, March 14, 2022 at 12:07:37 PM UTC-4 fliter wrote:

> I need to add comments to json, but now json version does not support 
> it
>


-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/d9c5fe9e-0109-438a-a932-b9d45c9328b3n%40googlegroups.com.


[go-nuts] Re: When will the official encoding/json package support parsing json5?

2022-03-20 Thread Brian Candler
If you're going down that route, you could also consider jsonnet 
 (which does have a Go implementation 
)

It will almost certainly be much more powerful than you need, but it *is* 
another superset of JSON which includes comments.

On Sunday, 20 March 2022 at 13:16:20 UTC christoph...@gmail.com wrote:

> You might want to try qjson that I wrote a year ago (
> https://github.com/qjson). 
> It's basically just one function that converts qjson text into json. Qjson 
> is inspired by hjson, but extend it in many ways. 
> It is convenient for config files. 
>
> Maybe I extend it a bit too far by supporting unquoted strings or single 
> quoted strings. Lol
>
>
> Le samedi 19 mars 2022 à 01:03:17 UTC+1, ben...@gmail.com a écrit :
>
>> Yeah, Go's encoding/json will almost certainly never support json5. 
>> However, one very simple approach: if you're using JSON for a config file 
>> and just need ability to add // line comments, you can just write a simple 
>> transformer which reads the file line by line and filters out lines that 
>> start with "//" (optionally preceded by whitespace), and then send the 
>> result to encoding/json.
>>
>> On Friday, March 18, 2022 at 1:59:21 PM UTC+13 r...@rwx.gg wrote:
>>
>>> It is my sincere hope that Go will never support anything as poorly 
>>> designed as JSON5, using reflection is already slow enough. Comments were 
>>> never intended for JSON and never should be added, ever. But since most 
>>> discerning development shops are moving to Protobuf for everything that 
>>> matters, perhaps that would be less of a problem.
>>>
>>> On Monday, March 14, 2022 at 12:07:37 PM UTC-4 fliter wrote:
>>>
 I need to add comments to json, but now json version does not support it

>>>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/a43994e7-176f-48b2-a732-f174d171b434n%40googlegroups.com.


[go-nuts] Re: When will the official encoding/json package support parsing json5?

2022-03-20 Thread christoph...@gmail.com
You might want to try qjson that I wrote a year ago 
(https://github.com/qjson). 
It's basically just one function that converts qjson text into json. Qjson 
is inspired by hjson, but extend it in many ways. 
It is convenient for config files. 

Maybe I extend it a bit too far by supporting unquoted strings or single 
quoted strings. Lol


Le samedi 19 mars 2022 à 01:03:17 UTC+1, ben...@gmail.com a écrit :

> Yeah, Go's encoding/json will almost certainly never support json5. 
> However, one very simple approach: if you're using JSON for a config file 
> and just need ability to add // line comments, you can just write a simple 
> transformer which reads the file line by line and filters out lines that 
> start with "//" (optionally preceded by whitespace), and then send the 
> result to encoding/json.
>
> On Friday, March 18, 2022 at 1:59:21 PM UTC+13 r...@rwx.gg wrote:
>
>> It is my sincere hope that Go will never support anything as poorly 
>> designed as JSON5, using reflection is already slow enough. Comments were 
>> never intended for JSON and never should be added, ever. But since most 
>> discerning development shops are moving to Protobuf for everything that 
>> matters, perhaps that would be less of a problem.
>>
>> On Monday, March 14, 2022 at 12:07:37 PM UTC-4 fliter wrote:
>>
>>> I need to add comments to json, but now json version does not support it
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/f580e928-0dd6-476a-ab3b-2e482b397f46n%40googlegroups.com.


[go-nuts] Re: When will the official encoding/json package support parsing json5?

2022-03-18 Thread ben...@gmail.com
Yeah, Go's encoding/json will almost certainly never support json5. 
However, one very simple approach: if you're using JSON for a config file 
and just need ability to add // line comments, you can just write a simple 
transformer which reads the file line by line and filters out lines that 
start with "//" (optionally preceded by whitespace), and then send the 
result to encoding/json.

On Friday, March 18, 2022 at 1:59:21 PM UTC+13 r...@rwx.gg wrote:

> It is my sincere hope that Go will never support anything as poorly 
> designed as JSON5, using reflection is already slow enough. Comments were 
> never intended for JSON and never should be added, ever. But since most 
> discerning development shops are moving to Protobuf for everything that 
> matters, perhaps that would be less of a problem.
>
> On Monday, March 14, 2022 at 12:07:37 PM UTC-4 fliter wrote:
>
>> I need to add comments to json, but now json version does not support it
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/789fe6c3-0ce7-456a-9b96-a86aac2a849an%40googlegroups.com.


[go-nuts] Re: When will the official encoding/json package support parsing json5?

2022-03-17 Thread Rob Muhlestein
It is my sincere hope that Go will never support anything as poorly 
designed as JSON5, using reflection is already slow enough. Comments were 
never intended for JSON and never should be added, ever. But since most 
discerning development shops are moving to Protobuf for everything that 
matters, perhaps that would be less of a problem.

On Monday, March 14, 2022 at 12:07:37 PM UTC-4 fliter wrote:

> I need to add comments to json, but now json version does not support it
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/3eff96a8-7f73-4142-a093-38f628bf6e61n%40googlegroups.com.