Questions tagged [json]
The json tag has no usage guidance.
43
questions
1
vote
1
answer
81
views
How to use jq-mode to query JSON in org-mode?
I wanted to use jq in org-mode to query JSON, and saw a jq-mode that supports org-babel:
jq-mode provides ob-jq for working with literate programming in Org
mode.
Add jq under org-babel-load-...
2
votes
3
answers
159
views
How to convert an org-table to JSON?
Here is a minimal example of an org-table:
#+NAME: radar
|----------+------|
| Variable | Val |
|----------+------|
| Red | 43.3 |
| Blue | 83.1 |
| Yellow | 86.4 |
|----------+------|
I ...
0
votes
1
answer
53
views
Loss of latex-mode Fontification When Loading Libraries in latex-mode-hook That Require json-mode
My actual scenario involves using latex-mode-hook to load some libraries that require json-mode.
I replicated my issue in a MWE:
I have a LaTeX file:
\documentclass{article}
\usepackage{mwe}
\begin{...
0
votes
0
answers
38
views
Emacs copy JSON Value
For a JSON block, is there any way to extract the value with a simple keybinding?;)
For example, the function should return foo:bar
"hukarz": "foo:bar",
0
votes
1
answer
136
views
JSON parsing fails: json-parse-error "too big integer"
I'm trying to parse a JSON file which contains large numbers:
{
"uuid": "c73b470a-5efb-4d53-9ac6-c5f6487f227b",
"description": "grains on square 64&...
0
votes
2
answers
332
views
Regex to find and replace a specific character inside of multiple quoted strings in a string
Given an example string of JSON (formatted here for reading, actual input may or may not be formatted):
{
"page":1,
"per_page":6,
"total":12,
"...
4
votes
0
answers
2k
views
Emacs with JSON support
I'm trying to compile emacs 28.2 (from https://ftp.gnu.org/gnu/emacs/) with json support on a Ubuntu-based system (Linux Mint). But I don't get it to work meaning that json-available-p is void and I ...
1
vote
2
answers
485
views
How to read JSON file in emacs and display it in the scratch buffers?
I've a json data returned by endpoint which is as below:
{
"id":"1383",
"entryPoint":"Stranger in the night.",
"Source":"music"
}
What I ...
1
vote
1
answer
158
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
232
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
155
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
503
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
161
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
119
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 ...
6
votes
1
answer
2k
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 ...
4
votes
1
answer
421
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
370
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 ...
1
vote
1
answer
2k
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
780
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
500
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
219
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
752
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
471
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
802
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-...
8
votes
2
answers
2k
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
2k
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
807
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
124
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
133
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
8k
views
Accessing JSON data in elisp
JSON:
{
"name": "xxxxx",
"job": "xxxxxx",
"projects": [
{
"name": "xxxxx",
"date": "xxxxx",
"about": "xxxxxxxxxx"
},
{
"name": "xxxxx",
"date": "xxxxx",...
6
votes
3
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 ...
16
votes
2
answers
3k
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
477
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
472
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
81
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
95
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
469
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
2k
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
2k
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
7k
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 ...