Questions tagged [json]
41 questions
20
votes
2 answers
Code-folding extensions for JSON
I am dealing with JSON files with multiple repeated blocks with just one field value (integer) changed - in fact, every changed value is just the previous corresponding value incremented. To make such files easy to read, I would like to be able to…

Pradhan
- 2,330
- 14
- 28
16
votes
2 answers
Outline editing, like org-mode, for JSON
I am trying to edit a Swagger JSON file in emacs. It contains large nested JSON objects, so I want to collapse and hide some of them.
I have tried origami-mode, configured as origami-c-style-parser in origami-parser-alist, but it is quite…

Robin Green
- 949
- 7
- 16
7
votes
2 answers
JSON file folding and step-by-step unfolding
I need to look at larger, quite deeply nested JSON files in Emacs. Similar to the terminal tool json-view I would like to start with the JSON file completely folded and then open each level step-by-step.
I've tried Emacs' built-in Hideshow minor…

halloleo
- 1,215
- 9
- 23
7
votes
1 answer
Accessing JSON data in elisp
JSON:
{
"name": "xxxxx",
"job": "xxxxxx",
"projects": [
{
"name": "xxxxx",
"date": "xxxxx",
"about": "xxxxxxxxxx"
},
{
"name": "xxxxx",
"date": "xxxxx",
"about": "xxxxxxxxxx"
},
{
…

I'm Mo
- 73
- 1
- 4
6
votes
2 answers
Is there a way to check whether or not a string is valid json?
I am trying to parse a string with the json.el package, though when the string is not json unexpected things happen. Is there a way in elisp to check whether or not a provided string is actually a valid json before trying to parse it with…

lookyhooky
- 949
- 7
- 18
5
votes
2 answers
How to iterate over JSON list and select one element
Say I have a list of names with ids, in JSON:
(let ((json-object-type 'plist))
(setq mylist (json-read-from-string "[{\"name\": \"Adam\", \"id\": \"1\"},
{\"name\": \"Eve\", \"id\": \"2\"}]")))
I want to…

andreas-h
- 1,559
- 13
- 22
4
votes
2 answers
json-readtable-error during org-capture
This problem only arose today and I haven't really changed anything substantial in my init.el so I am sure what the source of the error is. Essentially, when running org-capture (and also during startup) I get (json-readtable-error). When I set…

Quarky Quanta
- 415
- 4
- 12
4
votes
1 answer
org export json
I'm using the JSON produced by org-export-json to display it in a virtual DOM (the output is an array like [ element_type, properties{}, children[]... ] very suitable for this).
Being not very fluent in Lisp, I'm wondering how to modify this…

Flint
- 292
- 2
- 10
4
votes
1 answer
How to encode empty json object in elisp?
The json package coming with Emacs 24 has function json-encode that works like this:
(json-encode '(("key" . "value")))
"{\"key\":\"value\"}"
In case there are no keys (object is empty) I get:
(json-encode '())
"null"
when in this case I need to…

Gracjan Polak
- 1,082
- 6
- 21
4
votes
1 answer
JSON major mode complaining about valid JSON file
I am editing a dead simple JSON file:
{
"foo": "bar"
}
Here's what I see:
Doing a C-h m I see the following minor modes running alongside JSON mode:
Enabled minor modes: Auto-Composition Auto-Compression Auto-Encryption …

Marcus Junius Brutus
- 643
- 4
- 13
3
votes
1 answer
How do i create a nested list from a json data?
From JSON, I'm trying to build a nested list of nodes which should look like the expected result below:
(html (head (meta title)) (body (ul (div) (div) (div))) ; I guess this is the right approach for an interface label
This is the original data…

alexander
- 135
- 6
3
votes
1 answer
Insert json or XML blocks in org mode
I often have to insert blocks of json or XML code into my org documents.
What is the preferred way of doing so?
I see that for the standard:
#+BEGIN_SRC
...
#+END_SRC
... there is no json or xml in the list of supported languages:…

Ricky Robinson
- 267
- 2
- 10
3
votes
1 answer
How can I work around json-encode error with key "t"
While working with JSON in Emacs Lisp, I got an error json-encode-key: Bad JSON object key: t. It made sense to me that the key was "t" but not necessarily why, or what I can do about it.
The following code sample reproduces this scenario:
(let…

John Nelson
- 133
- 4
3
votes
1 answer
How do you get data by key from a json list?
I loaded some json data into a string and have elisp parsing it using the json-read-from-string function. Now I want to do is access data from the JSON by key. When I print out the data via message, it looks kind of like a list of lists (with…

chaseme
- 33
- 3
2
votes
1 answer
Org export to html
I tried exporting several org files to HTML without success. That came as a surprise, since I've done that tons of times. The message I was getting on the minibuffer shed some light.
End of file while parsing JSON
After some debugging (a…

aadcg
- 1,203
- 6
- 13