Help editing JSON files

Is there anyway or form to edit JSON trees/nodes, and apply complex modifications in bulk, like editing certain nodes that have certain values and so on?

nodes?

You mean live cntrl+h and changing them all?

More on the lines of “copy every node that has X type and change it to Y, then add it after the copied node”.

I don’t know and can’t find a way to script it.

jq should be good for that.
Alternatively python scripts.

[quote=“Coolthulhu, post:4, topic:11799”]jq should be good for that.
Alternatively python scripts.[/quote]

By what is in the manual, doesn’t look like jq can copy/duplicate specific objects in an array.

So now I have to ask: How does the Python script system works? I mean, I don’t mind learning Python, but I don’t know what tools to use to run Python scripts over JSON files.

Python has a json library that operates on specific fields/entries. Basically, loads the jsons into a giant nested tree of arrays and dictionaries (in case of DDA, arrays of dictionaries).
Not sure how does it handle formatting, though.

It looks that for formatting it would need to re-format after dumping.

This is more FUN than I thought. Anyway, I don’t know if sticking to the manual method or go cry-me-a-river to Stack Overflow.

It’ll be fun updating mods thou.