BCP Output In JSON Line-Delimited Format

Although this is not a valid JSON format, many system use it to exchange data.

One advantage of line-delimited JSON format compared to the standard JSON is the fact that you can append new JSON objects at the end of the file without removing closing array bracket as in the standard JSON.

This might be a niche use case, but I’m sure that in this post-XML-all-the-things era, this is more common than you might first expect.

Related Posts

Jovan Popovic shows off the JSON_MODIFY function in SQL Server: Recently I found this question on stack overflow. The problem was in appending a new JSON object to the existing JSON array: UPDATE TheTable SET TheJSON = JSON_MODIFY(TheJSON, 'append $', N'{"id": 3, "name": "Three"}') WHERE Condition = 1; JSON_MODIFY function should take the array value […]

Bert Wagner shows how to build JSON arrays in SQL Server: When using FOR JSON PATH, ALL rows and columns from that result set will get converted to a single JSON string. This creates a problem if, for example, you want to have a column for your JSON string and a separate column for something like […]