1
night!
I need your help on the following question: I have 2 files . json, but when opening in Notepad++ I realize that the content is disorganized.
Example:
Arquivo1.json
{
"xxx.yyy.E-mail": "E-mail",
"xxx.yyy.Senha": "Senha",
"xxx.yyy.Voltar": "Volver",
"xxx.yyy.Enviar": "Enviar",
"xxx.yyy.Sair" : "Sair",
}
Arquivo2.json
{
"xxx.yyy.E-mail": "E-mail",
"xxx.yyy.Voltar": "Volver",
"xxx.yyy.Senha": "Senha",
"xxx.yyy.Sair" : "Sair",
"xxx.yyy.Enviar": "Enviar",
}
If you look at the order, it’s different! I need to sort the file 2.json to be in the same order as Arquivo1.json, taking into account that the files contain more than 3000 lines when opening in notepadd++.
Is there any way to sort the content of json ? I need to organize and then compare the contents line by line. Thanks in advance!!!
If your application depends on the order of the JSON data it probably has an architecture problem (or should not even use JSON, but some "fixed" format, such as plain text). I suggest rethinking the real problem, which is first interpreting JSON in your application, and then comparing the elements individually.
– Bacco
If you just want to compare in the text editor, select the 2 files and sort alphabetically. Then apply a diff to the files (but then the question may already be "almost out" :P of the site scope).
– Bacco