ietf
[Top] [All Lists]

Re: Last Call: <draft-ietf-appsawg-json-patch-08.txt> (JSON Patch) to Proposed Standard

2012-12-14 12:16:43

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" ] ] } }

instead of the desired

 { "a" : { "b" : [ "red", "green", "blue", "yellow" ] } }

I suggest the semantics of this case should be explicit, to avoid unexpected 
surprises.

-- 
David J. Biesack | Principal API Architect, SAS | @davidbiesack | 919-531-7771 
| www.sas.com

<Prev in Thread] Current Thread [Next in Thread>