0

sorry I'm a beginner in coding. I have a set of json array consisting of more than 100 variables. here's the example of the few data:

{"noreg":"643758","norm":"655","nama":"cindy minato ishii","normunit":"vm7546","tglreg":"02-04-2020","alamat":"yujeyuo prefecture, thaikhan st. 467, tokyo, japan","tgllahir":"30-04-1964","umur":"56","gender":"P","agama":"shinto","tglcu":"10-04-2020","pekerjaan":"vampire","paket":"GOLD"}

How can I iterate through, let's say: only from "noreg" variable through "alamat" variable, with looping? From far what I'm doing is this:

SELECT JSON_EXTRACT(xxx, '$.nama') AS nama,
                        .....
                        .....
                        .....
            JSON_EXTRACT(mcu_data, '$.alamat') AS alamat
FROM xxx
WHERE xxx

I'm tired in doing all the JSON_EXTRACT for = the amount of the data I need. Let's say 50. Then, I have to repeat that 50 times. Any solution will be so helpful.

Bonifacius Sarumpaet
  • 1,263
  • 1
  • 8
  • 21
  • I don't see any real advantage to doing this. Return the whole string and then in your PHP you can just use the parts you are after. – Nigel Ren Apr 03 '20 at 06:13
  • @NigelRen Yes, that would do just fine. I wonder why I didn't think in that simple way. But, I'm curious if there is any way to do that? Thank you btw for your answer, I appreciate it. – Bonifacius Sarumpaet Apr 03 '20 at 07:18

0 Answers0