Comment

Comment by jameshart

I can't help thinking that

   [
     { "op": "replace", "path": "/baz", "value": "boo" },
     { "op": "add", "path": "/hello", "value": ["world"] },
     { "op": "remove", "path": "/foo"}
   ]
would be better described as

     value["baz"] = "boo";
     value["hello"] = ["world"];
     delete value["foo"];
Why go to the trouble of defining your grammar as a strict subset of JSON documents, which are themselves written using a strict subset of JavaScript syntax, when you could just limit yourself instead to the strict subset of JavaScript syntax that encapsulates the operations you actually want to perform?
parent jameshart 12 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton