Android PHP Json

I have looked around for over a few hours and most of the post I see are from way back when, so maybe I just don't understand or it might be outdated. I have two problems.

I have an Json object and Json Array that comes out like this:

    {"command":"update", "Data":["first data","second data","third data","fourth data"]}     

I want it it to read like this:

{"command":"update", "Data":[{"1":"first data"},{"2":"second data"},{"1":"third data"},{"2":"fourth data"}]}

I am unclear how to add the 1 & 2 so I can know what to pull on the php side.And it might not be the proper format either, but you will get an ideal. Android code:

JSONObject parent = new JSONObject();
JSONArray child = new JSONArray();
child.put("first data");
child.put("second data");
parent.put("Data", child);

Next problem on my php side is pulling the data so I can put it into my database and I am unsure exactly how this is done:

// DECODE OUR JSON FROM ANDROID
$data = json_decode(file_get_contents('php://input'), true);

// FOR LOOP TO INSERT DATA INTO DATABASE
for($i=0; $i<count($obj['Data']); $i+=2) 
{
     // need to get 1 & 2 values to insert into database
     //$first = NEED VALUE OF 1
     //$second = NEED VALUE OF 2
     // mysqli statement to insert into database
     $Q = "INSERT INTO `DATA_TABLE` (data1, data2) VALUES ('$first', '$second');
     mysqli_query($conn, $Q);
}

Change your code to

JSONObject parent = new JSONObject();
JSONArray child = new JSONArray();
child.put({ "1", "first data" });
child.put({ "2", "second data" });

But I would more likely store your data as an object inside an array with each object being one insert into your database.

JSONObject parent = new JSONObject();
JSONArray child = new JSONArray();
JSONObject item1 = new JSONObject();
JSONObject item2 = new JSONObject();
...
item1.name = "Item 1 name";
item1.rating = "Item 1 rating";
...
child.put(item1);
child.put(item2);

Then you can iterate through each item in the data array and know that it contains all the data you need to populate your database.