Change data in Json file

Advanced Renamer forum
#1 : 04/02-22 02:49
Scott
Scott
Posts: 2
I have 10,000 JSON files to which I need to add a line of code to it. Am I able to do with ADR?

The json file says:
"image": "ipfs://bafybeibdlplmscehh746iufxeao7b35bljdfu575cf4/9971.png"

I need to add:
"animation_url": ".../9971.mp4"

Can I do this with ADR?

BTW.. this program has given me years back to my life. I've bought two biz copies of it just to help support. Seriously, years back to me.

Scott





04/02-22 02:49
#2 : 05/02-22 12:27
David Lee
David Lee
Posts: 1125
No, Advanced Renamer cannot write to files.

However it will be straightforward to do this using a command prompt.

Assuming that all your files have the extension .json and are in the same directory: open a cmd prompt in the folder and enter the code:

for %f in (*.json) do echo &echo "animation_url": ".../9971.mp4" >> %f

%f will contain the filename.

the first "echo" (without an argument) returns an empty line.

"&echo" will echo a new line of text (without the "&" the second "echo" and the following new line would be added as plain text to the first line).

">> %f" redirects the output from the console to the end of each file.


If the files are in separate folders you will require a bit more logic to step though the folders and may need to save the code in a batch file.


05/02-22 12:27