We help IT Professionals succeed at work.
Get Started

looping over JSON Object and insert into query

207 Views
Last Modified: 2016-11-01
Hi, I have the following JSON Object and i am trying to insert into the database:

try to find a simple way so loop over and it keeps on inserting and append the messages in the variable:

more important are the values which are inside the data say :
0
1
2
3
4
5
6
7
8 and its nested values

here is the attached JSON

{
   "status":"OK",
   "data":{
      "group_id":1522413460,
      "0":{
         "id":"1522413460-1",
         "customid":"",
         "customid1":"",
         "customid2":"",
         "mobile":"000000000",
         "status":"AWAITED-DLR"
      },
      "1":{
         "id":"1522413460-2",
         "customid":null,
         "customid1":null,
         "customid2":null,
         "mobile":"000000000",
         "status":"AWAITED-DLR"
      },
      "2":{
         "id":"1522413460-3",
         "customid":null,
         "customid1":null,
         "customid2":null,
         "mobile":"000000000",
         "status":"AWAITED-DLR"
      },
      "3":{
         "id":"1522413460-4",
         "customid":null,
         "customid1":null,
         "customid2":null,
         "mobile":"",
         "status":"INV-NUMBER"
      }
   },
   "message":"Campaign of 4 numbers Submitted successfully."
}

Open in new window

Comment
Watch Question
Commented:
This problem has been solved!
Unlock 1 Answer and 3 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE