Skip to content
Advertisement

while Convert sql query to json getting wrong output

I am getting wrong output

Output should be:

Advertisement

Answer

The problem is with your nested loops. You actually want to parallely iterate both lists. The lists themselves are quite complex due to the nesting of lists and tuples. That’s why you may loose track here. You could try simplifying the lists/objects if possible or storing parts of them in extra variables. It will make your job easier when dealing with them.

Now the solution to your problem: Instead of looping in foreach-manner, use an index and access the particular values in both lists/tuples.

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