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 . pato) (gato . 3))))
(json-pretty-print-buffer)
(buffer-string))
Whit this result:
"{
\"calimero\": \"pato\",
\"gato\": 3
}"
but I really need, this in one line with tabs and returns:
"{\n \"calimero\": \"pato\",\n \"gato\": 3\n}"
I tried with this but I get many extras things that I do not need:
(with-temp-buffer (insert (json-encode '((calimero . pato) (gato . 3))))
(let ((print-escape-newlines t))
(json-pretty-print-buffer)
(prin1-to-string (buffer-string))))
"\"{\\n \\\"calimero\\\": \\\"pato\\\",\\n \\\"gato\\\": 3\\n}\""
I want to fullfill this org mode plantuml block, with a json, with returns and spaces in order to view it as emacs pretty json but in the drawing inthe palntuml doc says that it needs to be in one line with "\n" and spaces:
Begining from this:
'((calimero . pato) (gato . 3))
getting this:
{\n "calimero": "pato",\n "gato": 3\n}
I will use in a plantuml diagram like this:
#+BEGIN_SRC plantuml :file hola.png
Alice -> Bob: {\n "calimero": "pato",\n "gato": 3\n}
Bob --> Alice:
#+END_SRC
#+RESULTS:
[[file:hola.png]]