Questions tagged [json]
The json tag has no usage guidance.
36
questions
1
vote
1
answer
26
views
How to use ediff with JSON, so it abstracts from member order in objects?
Currently I use ediff a lot for diffing all sorts of text files. I also use it for looking at diffs between JSON files. The problem is that a lot of differences appear which are semantically ...
0
votes
1
answer
34
views
LSP: Bad JSON object: ":", 97
I am using gccemacs, where emacs is build with --with-native-compilation configuration option.
After compilation is done,when I run M-x lsp: I start to have following error: Bad JSON object: ":&...
1
vote
2
answers
37
views
How to customize the delimiter in the minor mode Hideshow for use with JSON data?
The documentation of hs-minor-mode explains:
In C mode and related modes, blocks are delimited by braces, while in Lisp mode they are delimited by parentheses.
I use the mode to collapse objects ...
3
votes
1
answer
244
views
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 ...
0
votes
1
answer
66
views
Extract JSON from multi-line string, removing leading/trailing garbage
I am struggling to come up with a universal regexp that will remove/isolate all leading/trailing garbage from a multi-line string, leaving only the JSON. Without opening up a temporary buffer to re-...
0
votes
3
answers
70
views
Why am I getting this error, saying that a comma is not a function?
In a related thread https://emacs.stackexchange.com/a/34336/2287, a string (containing JSON data) is converted using json-read-from-string. The value returned in that example looks like this:
((1 ...
0
votes
0
answers
27
views
Error: End of file while parsing JSON
Error "End of file while parsing JSON" while trying to make request to monero-daemon-rpc.
(require 'json-rpc)
(setf monerod (json-rpc-connect "localhost" 18081))
(json-rpc ...
1
vote
1
answer
653
views
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 ...
3
votes
1
answer
166
views
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.
...
1
vote
1
answer
198
views
Manage JSON (comments) with org literate programming and tangle
I would like to manage a JSON config file with added comments on some key-value-pairs and explain options. Since it is not possible to comment in JSON, I thought about using org-mode literate ...
0
votes
1
answer
1k
views
How to make Emacs edit JSON data in `json-mode`?
I am working with GNU Emacs 23.1.1. When working with a .json file it is treated in the Fundamental mode:
How can I have the json file treated in the json mode?
I note that GNU Emacs 24.3.1 opens ...
0
votes
2
answers
654
views
Json - get count of elements
Emacs 26.1
Here json file:
[
{
"id": 11,
"name": "my name"
},
{
"id": 22,
"name": "my name3"
},
{
"id": 33,
"name": "my name3"
}
]
As you can see the count of ...
2
votes
1
answer
378
views
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 ...
0
votes
1
answer
159
views
how to generate dynamic json data with emacs (macros)?
I was in a meeting yesterday where I was presenting a program that referenced a certain json file with data like this:
[
{
id: 1,
text: '...',
...
},
{
id: 2,
text: '...',
...
}
]
In ...
0
votes
1
answer
583
views
Emacs, pretty print but showing spaces and \n
I'm making diagrams with plantuml and org mode, when preparing the JSONs, in order to plot well the diagram I need this representation of JSON:
(with-temp-buffer
(insert (json-encode '((calimero . ...
1
vote
1
answer
316
views
Where find good json formater and validation?
Emacs 26.1. Windows 10
It's has function json-pretty-print . But it not enough for me.
Has any another better json formater and validator?
I mean the next.
Suppose I has error on json on line 26. I ...
2
votes
1
answer
502
views
Get the path to the JSON element at point
Problem statement
Using Elisp, when point is on an element in a JSON datastructure (either raw JSON or an Elisp sexp of the kind generated by json.el), is there an easy way to get a json-pointer-get-...
6
votes
2
answers
1k
views
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-...
4
votes
2
answers
2k
views
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 ...
3
votes
1
answer
1k
views
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, ...
0
votes
1
answer
548
views
json-reformat-region on file open
currently I'm working a lot with json files. They tend to be a little bigger.
I'm a little fed up with always marking the whole file and then typing M-x json-reformat-region.
Is there a way to do ...
4
votes
1
answer
2k
views
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 ...
0
votes
2
answers
90
views
How do I filter an alist to just the properties I care about?
To effectively use a service's API, I'm leveraging json-read to turn the JSON response into an understandable data structure:
(let ((json-object-type 'alist)
(json-array-type 'list)
(...
0
votes
0
answers
112
views
Get emacs to read unquoted strings in json
I am trying to use emacs-lisp to interact with a MongoDB. Here is an example of a string that mongo returns, that emacs cannot read. The problem is the unquoted ObjectId and ISODate items (if I put ...
7
votes
1
answer
6k
views
Accessing JSON data in elisp
JSON:
{
"name": "xxxxx",
"job": "xxxxxx",
"projects": [
{
"name": "xxxxx",
"date": "xxxxx",
"about": "xxxxxxxxxx"
},
{
"name": "xxxxx",
"date": "xxxxx",...
6
votes
2
answers
1k
views
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 ...
15
votes
2
answers
2k
views
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 ...
1
vote
0
answers
355
views
Parsing nested json
I'm using request to grab a json file (here's one for instance: http://gd2.mlb.com/components/game/mlb/year_2015/month_06/day_10/grid.json) and trying to read the data. I'm interesting in looping ...
4
votes
1
answer
1k
views
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:
(...
4
votes
1
answer
402
views
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-...
0
votes
1
answer
79
views
How to load json.el included in emacs instead of fallback lib included in gnus
I want to use the json.el included in 24.5, but cannot do that, because gnus includes an older version of json.el that is loaded before the one from 24.5.
When running list-load-path-shadows I got ...
1
vote
1
answer
83
views
hs-minor-mode keybindings are undefined or bring up help window
I installed the json-mode package, then added this to my .emacs:
(require 'json-mode)
(add-hook 'json-mode-hook 'hs-minor-mode)
After opening a json file, I used Describe-variable on hs-minor-mode ...
1
vote
1
answer
373
views
json-mode hook not being run
I have
(add-hook 'json-mode 'flymake-json-load)
in my .emacs file, but it has no effect. I have to do M-x flymake-json-load whenever I visit a .json file. Why doesn't it work?
5
votes
2
answers
1k
views
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\"},
{\"...
1
vote
1
answer
1k
views
Error when opening IPython notebook list using EIN
I am not entirely sure where to post this question (here, stackoverflow....), but I am sure some emacs experts will be able to help me here. This question is also posted here https://github.com/tkf/...
20
votes
2
answers
5k
views
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 ...