Please describe your feature request.
I wish I could use yq to migrate configuration files written in the https://jsonc.org/ format, more specifically the VS Code dialect with trailing commas.
Describe the solution you'd like
If we have data1.jsonc like:
// sing-box 1.12.0 migration
{
"dns": {
"servers": [
{
"address": "local",
}
]
}
}
And we run a command:
yq -P -o jsonc -p jsonc '.dns.servers[0].type = .dns.servers[0].address'
it could output
// sing-box 1.12.0 migration
{
"dns": {
"servers": [
{
"address": "local",
"type": "local"
}
]
}
}
Describe alternatives you've considered
Some kind of prefilter+postfilter to erase trailing commas and to tag where comments are using special metadata keys, maybe.
Additional context
The full migration would've required at least a .dns.servers[0].type = .dns.servers[0].address; del(.dns.servers[0].type) though that doesn't seem to really work.
tidwall/jsonc implements a comment-and-trailing-comma stripper that preserves byte offsets but does not include information on where the comments are.
Please describe your feature request.
I wish I could use yq to migrate configuration files written in the https://jsonc.org/ format, more specifically the VS Code dialect with trailing commas.
Describe the solution you'd like
If we have data1.jsonc like:
And we run a command:
yq -P -o jsonc -p jsonc '.dns.servers[0].type = .dns.servers[0].address'it could output
Describe alternatives you've considered
Some kind of prefilter+postfilter to erase trailing commas and to tag where comments are using special metadata keys, maybe.
Additional context
The full migration would've required at least a
.dns.servers[0].type = .dns.servers[0].address; del(.dns.servers[0].type)though that doesn't seem to really work.tidwall/jsonc implements a comment-and-trailing-comma stripper that preserves byte offsets but does not include information on where the comments are.