On 15/12/2012, at 4:27 AM, David J. Biesack <David.Biesack@xxxxxxx> wrote: > > Can one add elements of array to an array? > > E.g. given the document > > { "a" : { "b" : [ "red", "green" ] } } > > If I want to add two values to an existing array, I can use > > [ > { "op": "add", "path": "/a/b/-", "value": "blue" }, > { "op": "add", "path": "/a/b/-", "value": "yellow" } > ] > > (I found in the examples how an array index is specified in the path, not in a separate "index" member; > I guess my comments there should be directed at draft-ietf-appsawg-json-pointer-06 ) > > However, for appending to arrays, I would like to use > > [ { "op": "add", "path": "/a/b/-", "value": [ "blue", "yellow" ] } ] > > Reading the spec literally, I expect that this will yield > > { "a" : { "b" : [ "red", "green", [ "blue", "yellow" ] ] } } Exactly. > instead of the desired > > { "a" : { "b" : [ "red", "green", "blue", "yellow" ] } } > > I suggest the semantics of this case should be explicit, to avoid unexpected surprises. I've added an example to clarify this; thanks. -- Mark Nottingham http://www.mnot.net/