[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: mapping data formats imported from C libraries
From: |
Lars Magne Ingebrigtsen |
Subject: |
Re: mapping data formats imported from C libraries |
Date: |
Wed, 26 Nov 2014 16:56:15 +0100 |
User-agent: |
Gnus/5.130012 (Ma Gnus v0.12) Emacs/25.0.50 (gnu/linux) |
Ted Zlatanov <address@hidden> writes:
> Yeah, I've seen the mess that libxml2 and json.el produce (not the
> coder's fault, it's just a pain to adapt without native types). It
> doesn't help that XML/SGML and Lisp are inbred cousins :)
>
> * it's a pain to distinguish JSON's `false' and `null' while using them
> in code
Well, I don't think that's a DOM point.
> * in json.el you pick the key-value storage method! yay!
>
> * in json.el you pick the array storage method! yay!
>
> * JSON data is not a tree
Sure it is.
{"a": {"b": [1, 2], "c": 4}}
> My ideal mapping from libjson and libyaml would be:
>
> * unambiguous: you can reconstruct a canonical version of the input
> stream from the parse data, as much as possible (JSON is better at this)
Trivial from the Emacs DOM.
> * native: you can iterate over JSON arrays as Lisp lists, and JSON
> key-value mappings as alists. JSON's `false' and `null' are both
> false in Lisp boolean context.
Outside the scope of the DOM.
> * clean: no extra cons cells for attributes
Doesn't matter. :-)
> * readable: this is huge IMO, to be able to pretty-print the data and
> quickly see what it contains... one of the things I like about JSON
> vs. SGML/XML.
`pp' prints the DOM real purdy like. I've web scraped bunches and
bunches of pages, and reading the DOM in the *scratch* buffer is really
easy.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
- Re: mapping data formats imported from C libraries, (continued)
- Re: mapping data formats imported from C libraries, Lars Magne Ingebrigtsen, 2014/11/25
- Re: mapping data formats imported from C libraries, Ted Zlatanov, 2014/11/25
- Re: mapping data formats imported from C libraries, Lars Magne Ingebrigtsen, 2014/11/25
- Re: mapping data formats imported from C libraries, Ted Zlatanov, 2014/11/25
- Re: mapping data formats imported from C libraries, Lars Magne Ingebrigtsen, 2014/11/25
- Re: mapping data formats imported from C libraries, Steinar Bang, 2014/11/26
- Re: mapping data formats imported from C libraries, Lars Magne Ingebrigtsen, 2014/11/26
- Re: mapping data formats imported from C libraries, Steinar Bang, 2014/11/26
- Re: mapping data formats imported from C libraries, Lars Magne Ingebrigtsen, 2014/11/26
- Re: mapping data formats imported from C libraries, Ted Zlatanov, 2014/11/26
- Re: mapping data formats imported from C libraries,
Lars Magne Ingebrigtsen <=
- Re: mapping data formats imported from C libraries, Ted Zlatanov, 2014/11/26
Re: DOM manipulation functions, raman, 2014/11/23
Re: DOM manipulation functions, Nicolas Richard, 2014/11/25
Re: DOM manipulation functions, Lars Magne Ingebrigtsen, 2014/11/26