The JSON spec does not require any whitespace after the object, newline or otherwise. And POSIX does not require that files end with a newline.
Maybe you are thinking of another spec, like https://jsonlines.org/ - but that's not part of JSON. On Tuesday 30 January 2024 at 14:16:35 UTC Xabi Martà wrote: > I'm writing a program that uses enconding/json and when writing the files > I see that it doesn't add a newline character at the end of the file, > according to > https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_206 > > it is supposed that a line is: > > 3.206 Line > A sequence of zero or more non- <newline> characters plus a terminating > <newline> character. > > so, I've to add it manually? why is not POSIX compatible? > > example: > > cat -e file.json | tail -n 2 > }$ > }% > > any help? thanks! > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/692bd65e-74f4-448a-b399-de8c38785aefn%40googlegroups.com.