LibreCat / Catmandu

Catmandu - a data processing toolkit
https://librecat.org
176 stars 31 forks source link

Exporter JSON provides invalid JSON #27

Closed vpeil closed 11 years ago

vpeil commented 11 years ago

Using Catmandu::Exporter::JSON gives you something like that:

{name: "Catmandu", creator: "Nicolas"}
{name: "Perl", creator: "Larry"}

But for a valid JSON document it should be: [ {name: "Catmandu", creator: "Nicolas"}, {name: "Perl", creator: "Larry"} ]

nics commented 11 years ago

hi vitali, that's intentional, the json exporter gives you line-delimited json. every line is a valid json doc, which enables easier stream processing, feeding of documents into mongodb, etc. that said, we should add an option to the exporter to output an array and make the importer use a streaming json parser so we can handle gigantic json arrays

On 28 Aug 2013, at 10:28, Vitali Peil wrote:

Using Catmandu::Exporter::JSON gives you something like that:

{name: "Catmandu", creator: "Nicolas"} {name: "Perl", creator: "Larry"} But for a valid JSON document it should be: [ {name: "Catmandu", creator: "Nicolas"}, {name: "Perl", creator: "Larry"} ]

— Reply to this email directly or view it on GitHub.

vpeil commented 11 years ago

hi, yes every single line is a valid json doc. the array option and streaming parser sounds good.

On 28.08.2013 10:39, Nicolas Steenlant wrote:

hi vitali, that's intentional, the json exporter gives you line-delimited json. every line is a valid json doc, which enables easier stream processing, feeding of documents into mongodb, etc. that said, we should add an option to the exporter to output an array and make the importer use a streaming json parser so we can handle gigantic json arrays

On 28 Aug 2013, at 10:28, Vitali Peil wrote:

Using Catmandu::Exporter::JSON gives you something like that:

{name: "Catmandu", creator: "Nicolas"} {name: "Perl", creator: "Larry"} But for a valid JSON document it should be: [ {name: "Catmandu", creator: "Nicolas"}, {name: "Perl", creator: "Larry"} ]

— Reply to this email directly or view it on GitHub.

— Reply to this email directly or view it on GitHub https://github.com/LibreCat/Catmandu/issues/27#issuecomment-23399209.

Vitali Peil Fachreferent PUB Raum E1-144, Tel. 0521 106 6125 Universitätsbibliothek Bielefeld

nichtich commented 11 years ago

So this can be closed, right?

vpeil commented 11 years ago

yeah, 6ee8a198fe0692188320bb16adbee4a545aca5f8