I am new to creating files. I need to create JSON that I will import into my firewall. I created two test rules so that I could export the format of the file I will need to create for import. The final output will need to look like this:
[
{
"id" : 1,
"enabled" : true,
"category" : null,
"readOnly" : null,
"description" : "Test Rule #1",
"string" : "1.2.3.4",
"name" : null,
"flagged" : true,
"javaClass" : "com.testServer.uvm.node.GenericRule",
"blocked" : true
}, {
"id" : 2,
"enabled" : true,
"category" : null,
"readOnly" : null,
"description" : "Test Rule #2",
"string" : "1.2.3.5",
"name" : null,
"flagged" : true,
"javaClass" : "com.testServer.uvm.node.GenericRule",
"blocked" : true
}
]
I have a text file that contains all of the IP's I want insert into the file. The Description will be a static description.
The text file IP's are listed one per line like:
1.2.3.4
1.2.3.5
I'm pretty new at programming I've used Java and VB before but have never had to read a file, insert that record into a new string in a new file, and then do the next record. If another language would be easier I will learn whatever I need to. This is something that I will be using for other projects after I get the hang of it.