-2
I have a text file where I need to read two lines at a time with each loop iteration. With this result I will mount a json. Simple example:
I have a text file:
JOAO PEREIRA
00000000000
PEDRO SILVA
11111111111
MARIA SOUSA
33333333333
I need to read two lines so that I can cut the strings and put it into an array to then mount the json. The way out of this is gonna stay that way:
"Registros": [
{
"nome": "Joao",
"sobrenome:": "PEREIRA",
"cpf:": "0000000000"
},
{
"nome": "PEDRO",
"sobrenome:": "SILVA",
"cpf:": "1111111111"
},
{
"nome": "MARIA",
"sobrenome:": "SOUSA",
"cpf:": "3333333333"
}
If you went one line at a time, as you would?
– Woss