Johannes Löthberg via aur-dev schreef op 2016-09-22 20:23:
Hey,
On 22/09, Alad Wenter wrote:
JSON from the RPC interface seems to not contain a terminating newline, regardless of version or type specified. I am curious if there is a particular reason for this, as the POSIX standard defines text files to contain lines with terminating newlines. [1] [2]
This is more noticeable when merging the resulting files to a valid JSON structure, e.g. to display the union of various search results. As a comparison, journalctl - json does terminate lines with a newline.
The RPC just returns whatever json_encode gave it, and doesn't do anything manual to the data returned. (And they're not actually files at any stage, so what POSIX wants doesn't matter much. ;))
Anyway, we could definitely add it, but every json tool should definitely be able to handle them as it is. Examples of ones that don't?
True, I haven't had issues with json tools regarding a (lack of) terminating newlines. Some tools like jshon do have an issue with several requests pasted together, unless you insert some commas. In that sense I wondered on how the RPC terminates its output, and how it may do so in the future. Of course, if/when we get POST requests [1], you no longer have to think on merging JSON. :) Thanks, Alad [1] https://bugs.archlinux.org/task/49089