Hello all,

As regards multiple JSON records in a single file, I have written
up a proposal here:
http://en.wikipedia.org/wiki/User:Baxter.brad/Drafts/JSON_Document_Streaming_Proposal

So this is sort of an RFC.  I've added a proof-of-concept routine
that implements the proposal to this module (see each_record()):
http://search.cpan.org/dist/MARC-Utils-MARC2MARC_in_JSON/

In the proposal, I say that I'm not a fan of newline-delimited JSON
files, but really, I just couldn't figure out a way to advertise them
that I liked.  So I'd like to hear ideas about that.

Anyway, I think it's a workable proposal, so I'd like to know what
you all think.

Thanks,

Brad

PS: Please don't read too much into the wikipedia address; I have
no plans to write an article.  It's just a nice place for allowing folks
to edit the contents if they are so inclined.

On Thu, Feb 10, 2011 at 9:19 AM, Galen Charlton <gmcha...@gmail.com> wrote:
> Hi,
>
> On Thu, Feb 10, 2011 at 9:06 AM, Brad Baxter <b...@mail.libs.uga.edu> wrote:
>> I had also thought about how to separate JSON records in a single file.
>> Perhaps this has been solved already, but I haven't seen a reference
>> to it.  If it were YAML, you could simply put "\n---\n" between the JSON
>> objects, and it would be simple to scan for that.
>
> A couple ways to go about it:
>
> [1] Simply define a collection of MARC-in-JSON records as an array and
> use a progressive JSON parser to handle large collections.
> [2] Use newline-delimited JSON, i.e., eliminate interior newlines and
> just read or write MARC-in-JSON records under the assumption each
> record occupies one line in the file.
>
> The first is slightly more time-consuming to implement but ensures
> that MARC-in-JSON files are always conformant JSON.  The latter is
> easier and can Get Things Done quicker but produces output that can't
> be handled correctly by just any random JSON parser.
>
> Regards,
>
> Galen
> --
> Galen Charlton
> gmcha...@gmail.com
>

Reply via email to