0
Good afternoon,
I would like your guidance, I am a little confused on how to proceed in a situation in Java + Spring Boot.
I get from the database 2 columns of strings, the first is a path delimited by a bar like "Crumbs[0]/link/path" and the other column contains the corresponding value of the first column, and I need to create a nested JSON with its respective values.
For example, I am getting from a database the following response in two columns:
COLUNA 1(Caminho), COLUNA 2(Valor)
"crumbs[0]/link/path", "/pokemon/tipo/pokemons?lang=pt-BR"
"crumbs[0]/link/wid", "tabelaPokemons",
"crumbs[0]/name", "Pokemons"
"data/records[1]/id", "Pikachu"
"data/records[1]/link/path": "/pokemon/tipo/eletrico/pikachu",
"data/records[1]/link/wid": "tabelaEletrico",
"data/records[1]/available": "true",
"data/records[2]/id", "Bulbasaur"
"data/records[2]/link/path": "/pokemon/tipo/planta/bulbasaur",
"data/records[2]/link/wid": "tabelaPlanta",
"data/records[2]/available": "true",
Having that answer from the bank, I’m expecting the following result:
"crumbs": [
{
"link": {
"path": "/pokemon/tipo/pokemons?lang=pt-BR",
"wid": "tabelaPokemons"
},
"name": "Pokemons"
}
],
"data": {
"records": [
{
"id": "Pikachu",
"link": {
"path": "/pokemon/tipo/eletrico/pikachu",
"wid": "tabelaEletrico"
},
"available": "true",
},
{
"id": "Bulbasaur",
"link": {
"path": "/pokemon/tipo/planta/bulbasaur",
"wid": "tabelaPlanta"
},
"available": "true",
}
]
}
I’m really confused if this is possible, would you have any advice or guidance to clear my mind a little bit and achieve that goal?
Thank you! Thank you for your attention.