Loading ...
Sorry, an error occurred while loading the content.

Re: JSON Patch Internet-Draft 02

Expand Messages
  • Ted Elliott
    Does the value type have to be a string, or does it support the other types, e.g. true/false, numbers, objects, arrays, etc. I believe it should be any valid
    Message 1 of 4 , Dec 1, 2011
    View Source
    • 0 Attachment
      Does the value type have to be a string, or does it support the other
      types, e.g. true/false, numbers, objects, arrays, etc. I believe it should
      be any valid json. Otherwise it's of limited usefulness. Some examples:

      original document:
      {
      "foo": "bar"
      }

      patch:
      [
      { "add": "/foo/obj", "value": {} },
      { "add": "/foo/obj/bool", "value": true },
      { "add": "/foo/obj/int", "value": 123 },
      { "add": "/foo/obj/dec", "value": 123.12 },
      { "add": "/foo/arr", "value": [] },
      { "add": "/foo/arr/0", "value": "x" }
      ]

      resulting document:
      {
      "foo": "bar",
      "obj": {
      "bool" : true,
      "int": 123,
      "dec": 123.12
      },
      "arr": [ "x" ]
      }


      [Non-text portions of this message have been removed]
    • Ted
      Sorry, messed up the patch portion a little bit. It should be this instead: patch: [ { add : /obj , value : {} }, { add : /obj/bool , value : true }, {
      Message 2 of 4 , Dec 1, 2011
      View Source
      • 0 Attachment
        Sorry, messed up the patch portion a little bit. It should be this instead:
        patch:
        [
        { "add": "/obj", "value": {} },
        { "add": "/obj/bool", "value": true },
        { "add": "/obj/int", "value": 123 },
        { "add": "/obj/dec", "value": 123.12 },
        { "add": "/arr", "value": [] },
        { "add": "/arr/0", "value": "x" }
        ]


        --- In json@yahoogroups.com, Ted Elliott <elliott.ted@...> wrote:
        >
        > Does the value type have to be a string, or does it support the other
        > types, e.g. true/false, numbers, objects, arrays, etc. I believe it should
        > be any valid json. Otherwise it's of limited usefulness. Some examples:
        >
        > original document:
        > {
        > "foo": "bar"
        > }
        >
        > patch:
        > [
        > { "add": "/foo/obj", "value": {} },
        > { "add": "/foo/obj/bool", "value": true },
        > { "add": "/foo/obj/int", "value": 123 },
        > { "add": "/foo/obj/dec", "value": 123.12 },
        > { "add": "/foo/arr", "value": [] },
        > { "add": "/foo/arr/0", "value": "x" }
        > ]
        >
        > resulting document:
        > {
        > "foo": "bar",
        > "obj": {
        > "bool" : true,
        > "int": 123,
        > "dec": 123.12
        > },
        > "arr": [ "x" ]
        > }
        >
        >
        > [Non-text portions of this message have been removed]
        >
      • Paul C. Bryan
        It supports any value type, including objects and arrays. Paul ... [Non-text portions of this message have been removed]
        Message 3 of 4 , Dec 3, 2011
        View Source
        • 0 Attachment
          It supports any value type, including objects and arrays.

          Paul

          On Thu, 2011-12-01 at 09:05 -0500, Ted Elliott wrote:

          >
          >
          > Does the value type have to be a string, or does it support the other
          > types, e.g. true/false, numbers, objects, arrays, etc. I believe it
          > should
          > be any valid json. Otherwise it's of limited usefulness. Some
          > examples:
          >
          > original document:
          > {
          > "foo": "bar"
          > }
          >
          > patch:
          > [
          > { "add": "/foo/obj", "value": {} },
          > { "add": "/foo/obj/bool", "value": true },
          > { "add": "/foo/obj/int", "value": 123 },
          > { "add": "/foo/obj/dec", "value": 123.12 },
          > { "add": "/foo/arr", "value": [] },
          > { "add": "/foo/arr/0", "value": "x" }
          > ]
          >
          > resulting document:
          > {
          > "foo": "bar",
          > "obj": {
          > "bool" : true,
          > "int": 123,
          > "dec": 123.12
          > },
          > "arr": [ "x" ]
          > }
          >
          > [Non-text portions of this message have been removed]
          >
          >
          >
          >
          >



          [Non-text portions of this message have been removed]
        Your message has been successfully submitted and would be delivered to recipients shortly.