I have a service that returns an object like this:
[
{id: 1, name: 'Pedro', city:1, state: 1, country: 1},
{id: 2, name: 'Juan', city:12, state: 2, country: 1},
{id: 3, name: 'Ana', city:10, state: 5, country: 1},
{id: 4, name: 'Diego', city:7, state: 9, country: 1},
{id: 5, name: 'Jose', city:4, state: 2, country: 1},
{id: 6, name: 'David', city:7, state: 9, country: 1},
{id: 7, name: 'Adriana', city:1, state: 1, country: 1},
{id: 8, name: 'Jorge', city:15, state: 2, country: 1},
];
How to create an object that has the following structure:
countries >> states >> cities >> persons