problem parsing valid JSON array
electerious opened this issue · 3 comments
electerious commented
My .rc
file contains a valid JSON starting with a square bracket:
[
{ "hello": "world" }
]
And rc outputs the following:
{ '[': true,
'{ "hello": "world" }': true,
']': true,
_: [],
configs: [ '/Users/tobiasreich/Sites/Rosid/.rosidrc' ],
config: '/Users/tobiasreich/Sites/Rosid/.rosidrc' }
I tested the strip-json-comments
module and it's not causing this problem. I guess it's because rc tries to merge the JSON with the defaults.
legodude17 commented
The problem is caused by the auto detection of ini. The parser parses anything that starts with {
as JSON and anything else as ini. My PR (#85) will actually fix that.
dominictarr commented
it doesn't make sense to use a array inside an rc config file. this should be treated as an error.
legodude17 commented
Even if you think of that as an error, parsing it as ini is definitely the wrong response. Maybe you could just error if the first char is [ and it is on its own line?