variable[] = [] # append new item in the array
variable[integer] = [] # alter the (already-available/pre-existing) index in the array
variable[non-integer] = {} # object
y[][non-integer] = [{}] # create an object as a newly created array element
variable[integer][non-integer] = [{}] # alter the object at the pre-existing indexed position
y[non-integer][] = {[]} # append a new array element to the key
variable[non-integer][integer] = {[]} # alter the pre-existing array index of the key-value object
-
Query string:
y[]=1&y[]=2&y[]=3
{ "y": [ "1", "2", "3" ] // auto append/push }
-
Query string:
y[]=1&y[]=2&y[]=2&y[1]=3
{ "y": [ // zero-based indexing "1", "3", "2" ] // notice the values }
-
Query string:
y[a]=1&y[b]=2
{ "y": { "a": "1", "b": "2" } }
-
Query string:
y[a][]=1&y[a][]=2&y[a][]=3
{ "y": { "a": [ "1", "2", "3" ] } }
-
Query string:
y[][a]=1&y[][b]=2&y[][c]=3
{ "y": [ { "a": "1" }, { "b": "2" }, { "c": "3" } ] }
-
Query string:
y[0][a]=1&y[0][b]=2&y[][c]=3&y[1][d]=4&y[0][e]=5&y[][f]=6
{ "y": [ { "c": "3", "e": "5" }, { "f": "6" } ] }
-
Query string:
y[a]=1&y[a]=2
{ "y": { "a": "2" } } // overwritten
-
Query string:
y[0]=1&y[0]=2
{ "y": [ "2" ] } // overwritten
-
Query string:
y[a][][]=1.0&y[a][0][]=1.5&y[a][0][]=1.9&y[a][]=2&y[a][]=3&y[b]=4&y[c]=5
{ "y": { "a": [ [ "1.0", "1.5", "1.9" ], "2", "3" ], "b": "4", "c": "5" } }
-
Query string:
y[0]=1&y[1]=2&y[5]=3
{ "y": [ ] // non-existing indices are simply ignored }
-
Query string:
y[5]=1&y[]=0&y[3]=3&y[0]=2
{ "y": [ "2" ] }
-
Query string:
y[4]=1&y[]=0&y[]=1&y[]=2&y[]=3&y[]=4&y[]=5
{ "y": [ "0", "1", "2", "3", "4", // no effect since it was declared before this index-position ever existed "5" ] }
-
Query string:
y=0&y=1&y=2&y=3&y=4&y=5
{ "y": "5" }
-
Query string:
y[][a]=1&y[][c]=3&y[1][d]=4&y[2][g]=5&y[][f]=6
{ "y": [ { "a": "1", }, { "c": "3", "d": "4" }, { "f": "6" } ] }
-
Query string:
y[]=1&y[a]=2
{ "y": [ "1" ] // transformation of array to object and vice versa is not possible }
-
Query string:
y[a]=1&y[]=2
{ "y": { "a": "1" } // transformation of object to array and vice versa is not possible }
-
Query string:
y[a]=1&y[0]=2
{ "y": { "a": "1" } // transformation of object to array and vice versa is not possible }
-
Query string:
y[a]=1&y=2
{ "y": { "a": "1" } // transformation of object to static value and vice versa is not possible }
-
Query string:
y[]=1&y=2
{ "y": [ "1" ] // transformation of array to static value and vice versa is not possible }
-
Query string:
y=2&y[]=1
{ "y": "2" // transformation of static value to object and vice versa is not possible }
Open to scrutiny and correction