You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Paul Spencer <pa...@mindspring.com> on 2022/05/16 14:42:01 UTC
How to preserve comments and property order in json configuration files?
Karaf 4.3.6
The OSGi specification mentions the support of comments in json configuration files, https://docs.osgi.org/specification/osgi.cmpn/7.0.0/service.configurator.html#d0e131566, but the comments are stripped and the properties are reorder when a configuration file is read.
How can comments and property order in json configuration files be preserved?
***
* foo.json before config:property-list --pid foo
***
{
// Network Port Number
"port":300,
// Array of int
"an_int_array":[ 2, 3, 4 ],
// Complex structure
"complex":{
"a":1,
"b":"two"
}
}
***
* foo.json after config:property-list --pid foo
***
{
"an_int_array":[
2,
3,
4,
5
],
"complex":"{\"a\":1,\"b\":\"two\"}",
"port":300
}
Paul Spencer
Re: How to preserve comments and property order in json configuration files?
Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi,
Comments are conserved in property/cfg files (thanks to Felix Utils
Properties), but I don't think I've implemented this in the JSON
config support.
Worth to create a jira as well :)
Thanks,
Regards
JB
On Mon, May 16, 2022 at 4:42 PM Paul Spencer <pa...@mindspring.com> wrote:
>
> Karaf 4.3.6
>
> The OSGi specification mentions the support of comments in json configuration files, https://docs.osgi.org/specification/osgi.cmpn/7.0.0/service.configurator.html#d0e131566, but the comments are stripped and the properties are reorder when a configuration file is read.
>
> How can comments and property order in json configuration files be preserved?
>
>
>
> ***
> * foo.json before config:property-list --pid foo
> ***
> {
> // Network Port Number
> "port":300,
>
> // Array of int
> "an_int_array":[ 2, 3, 4 ],
>
> // Complex structure
> "complex":{
> "a":1,
> "b":"two"
> }
> }
>
>
> ***
> * foo.json after config:property-list --pid foo
> ***
> {
> "an_int_array":[
> 2,
> 3,
> 4,
> 5
> ],
> "complex":"{\"a\":1,\"b\":\"two\"}",
> "port":300
> }
>
>
> Paul Spencer