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 fold this entire set of repeated blocks into just one block with some indication of what the ranges of the changing value across these blocks is. Searching for code folding methods in Emacs, I found hs-minor-mode
and outline-mode
. However, I don't see how to go from the functionality they provide to the one I desire. Could someone provide a rough overview of how I could achieve this?
An example of what I am trying to do:
Given a JSON file that looks like this:
{
"SomeArray": [
{
"ChangingField": 1,
"ConstantField" : "X"
},
{
"ChangingField": 2,
"ConstantField" : "X"
},
{
"ChangingField": 3,
"ConstantField" : "X"
},
{
"ChangingField": 4,
"ConstantField" : "X"
},
{
"ChangingField": 5,
"ConstantField" : "X"
}
]
}
I would like to have it displayed like this:
{
"SomeArray": [
{
"ChangingField": 1...5,
"ConstantField" : "X"
}
]
}
Apologies for the very open-ended question.