chimpler / pyhocon

HOCON parser for Python
Apache License 2.0
502 stars 118 forks source link

Conversion results (JSON, HOCON, ...) do not end with a new line #270

Open sbachstein opened 3 years ago

sbachstein commented 3 years ago

Version 0.3.58

This affects all available converters. I use JSON here as an example:

import pyhocon
config = pyhocon.ConfigTree()
config.put('foo', 'bar')
pyhocon.HOCONConverter.convert(config, 'json')

Result: '{\n "foo": "bar"\n}'

Expected: '{\n "foo": "bar"\n}\n'

The new line character is desirable for a number of reasons, one of them it being the POSIX standard. For a larger discussion, see, for example, this thread: https://stackoverflow.com/questions/729692/why-should-text-files-end-with-a-newline