I've been studying Json recently to use my projects to replace databases in some cases, in my tests I found a doubt. depending on the project I can end up repeating some values in certain items several times during the code for example
[
{
"Empresa" : "Unimed",
"Categoria" : "Hospital",
"Tags" : ["Plano de saude" , "Clinicas diversas", "Venda de serviços" ],
"Endereco" : "Rua Fulano de Tal",
"IconeEmpresa" : "icone.png",
"IconeCategoria": "hospital.png"
},
{
"Empresa" : "Ipiranga",
"Categoria" : "Posto de gasolina",
"Tags" : ["Venda de Produtos", "Venda de serviços" ],
"Endereco" : "Rua Fulano",
"IconeEmpresa" : "icone2.png",
"IconeCategoria": "posto.png"
},
{
"Empresa" : "Beneficente",
"Categoria" : "Hospital",
"Tags" : ["Plano de saude" , "Venda de serviços" ,"Medico Especializado"],
"Endereco" : "Rua Almirante Jequitir",
"IconeEmpresa" : "icone3.png",
"IconeCategoria": "hospital.png"
},
{
"Empresa" : "FarmaBem",
"Categoria" : "Farmacia",
"Tags" : [ "Venda de serviços" ],
"Endereco" : "Rua Sicranol",
"IconeEmpresa" : "icone4.png",
"IconeCategoria": "farmacia.png"
}
]
In this case, for example, the item "Category" has a limit on the possibilities of value (in this example I put 3 values, Hospital, Gas Station and Pharmacy, if I were to insert a new registry it should add one of these 3 existing categories causing the repetition) in addition the "Category" is directly linked to the "IconCategory" and each category has a single corresponding icon.
My question is, if there is a way to optimize these items, so that there is no risk that a category with a different name (hospital type instead of Hospital) will be inserted or if you change the logic or the name of any category in the future needs to change line by line (Example, in the future it may be necessary to unify the "Category" Hospital and Pharmacy by creating a new "Category" Health).