GNU bug report logs - #21798
25.0.50; [PATCH] Add support for retrieving paths to JSON elements

Previous Next

Package: emacs;

Reported by: Simen Heggestøyl <simenheg <at> gmail.com>

Date: Sat, 31 Oct 2015 08:47:01 UTC

Severity: wishlist

Tags: patch

Found in version 25.0.50

Done: Simen Heggestøyl <simenheg <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Simen Heggestøyl <simenheg <at> gmail.com>
Cc: 21798 <at> debbugs.gnu.org
Subject: bug#21798: 25.0.50; [PATCH] Add support for retrieving paths to JSON elements
Date: Tue, 3 Nov 2015 04:00:56 +0200
Hello Simen,

On 11/02/2015 01:27 AM, Simen Heggestøyl wrote:

> I managed to produce a benchmark with the following JSON file (560K,
> ~10,000 lines): http://folk.uio.no/simenheg/huge.json.
>
> I read it into `huge-json', and ran the following before the patch:  ...

Thanks. In my testing, too, the difference seems to be statistically 
insignificant. That's good.

I have to say, I'm still not very comfortable with mixing it sort of 
alien logic inside json-read-object and json-read-array (would anyone 
else like to chime in with their opinion?).

I do believe we want this functionality, though. One option to tighten 
the implementation is to extract common pieces from json-read-object and 
json-read-array, and implement two new functions using them, but the 
while-loops used there will make avoiding just copying code somewhat 
difficult.

Here's an idea: both json-read-object-1 and json-read-array-2 will 
advise json-read to add the new logic around calls to it (there will 
have to be some guard in the advice, so that recursive calls are run 
unmodified).

And json-path-to-position will locally modify json-readtable to use 
json-read-object-1 and json-read-array-2.

That's just a suggestion, though.




This bug report was last modified 9 years and 201 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.