script de formato json por Emacs Lisp

exemplo

obter json em http://www.redmine.org/issues/90.json

{"issue":{"author":{"name":"Matt Jones","id":61},"status":{"name":"New","id":1},"subject":"Show deleted wiki pages or wiki files on the activity","project":{"name":"Redmine","id":1},"done_ratio":0,"custom_fields":[{"value":"","name":"Resolution","id":2}],"category":{"name":"Wiki","id":1},"created_on":"2007/08/15 02:55:00 +0200","tracker":{"name":"Feature","id":2},"description":"The problem with this, is that the Activity section is the first page I go to see if anything has happened in my project.rnSo someone with 'wiki delete' and 'file delete' permissions could go in, and delete pages and files. I would never knowrnif they did this until I checked the wiki manually.rnrnWhat I would do is this:rn# For files added to the wiki, I would add a link to the page in the Activity sectionrn# For files deleted in the wiki, I would add a link to that wiki page in the Activity sectionrn# For wiki pages deleted, I would just add text saying what page was deleted in the Activity section. We cant link torna page that no longer exists.","updated_on":"2011/03/24 10:34:35 +0100","id":90,"priority":{"name":"Normal","id":4}}}

Como

  1. Baixe https://gist.github.com/1789605 e eval.
  2. Execute M-x json-reformat-region, formate a região como string json.

Resultado

{
"issue": {
"priority": {
"id": 4,
"name": "Normal"
},
"id": 90,
"updated_on": "2011/03/24 10:34:35 +0100",
"description": "The problem with this, is that the Activity section is the first page I go to see if anything has happened in my project.
So someone with 'wiki delete' and 'file delete' permissions could go in, and delete pages and files. I would never know

if they did this until I checked the wiki manually.


What I would do is this:

# For files added to the wiki, I would add a link to the page in the Activity section

# For files deleted in the wiki, I would add a link to that wiki page in the Activity section

# For wiki pages deleted, I would just add text saying what page was deleted in the Activity section. We cant link to

a page that no longer exists."
,
"tracker": {
"id": 2,
"name": "Feature"
},
"created_on": "2007/08/15 02:55:00 +0200",
"category": {
"id": 1,
"name": "Wiki"
},
"custom_fields": [
{
"id": 2,
"name": "Resolution",
"value": ""
}
],
"done_ratio": 0,
"project": {
"id": 1,
"name": "Redmine"
},
"subject": "Show deleted wiki pages or wiki files on the activity",
"status": {
"id": 1,
"name": "New"
},
"author": {
"id": 61,
"name": "Matt Jones"
}
}
}