Line-oriented data formats

·

One object per line, suitable for parsing as a stream.

CSV

id,title,date
1,Example One,2014-02-26
2,Example Two,2014-02-27

\n for newline; no data types.

Example: PLOS Search API

JSON

{"id":1,"title":"Example One","date":"2014-02-26"}
{"id":2,"title":"Example Two","date":"2014-02-27"}

\r\n for newline; String, Number, Boolean and Array data types, no Date data type.

Allows nested objects.

Example: Twitter Streaming API

XML

<item id="1" title="Example One" date="2014-02-26"/>
<item id="2" title="Example Two" date="2014-02-27"/>

Data types for each field can be specified in an external XML Schema file.

Turtle

@prefix dc: <http://purl.org/dc/elements/1.1/> .
_:1 dc:title "Example One"; dc:date "2014-02-26" .
_:2 dc:title "Example Two"; dc:date "2014-02-27" .

or

_:1 <http://purl.org/dc/elements/1.1/title> "Example One"; <http://purl.org/dc/elements/1.1/date> "2014-02-26" .
_:2 <http://purl.org/dc/elements/1.1/title> "Example Two"; <http://purl.org/dc/elements/1.1/date> "2014-02-27" .

All fields have data types implied by the predicate, but - to be explicit - add @en to the title field and ^^<http://www.w3.org/2001/XMLSchema#date> to the date field.