Skip to content
Advertisement

how do I get nested pojo result from php mysql

How to get nested pojo result like this one,

JavaScript

This is I got from somewhere I forgot, but it has no code for make this result.

JavaScript

with my code like this

JavaScript

the result of mine like this

JavaScript

Yeah I know it’s somekind old question, with many of questions similiar to. But I have no clue at all. I appreciate any help. Thanks.

Advertisement

Answer

If you want to get different json type into single json, you can split query first, and you execute each of query. To get nested object result like this

JavaScript

try execute

JavaScript

for nested array

JavaScript

use this

JavaScript

and to merge it to single json you can use

JavaScript

Hope it can helps

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement