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

Re: Non-unique keys in JSON objects

Expand Messages
  • douglascrockford
    ... You can do as you like, but I think it would be better if you throw the exception.
    Message 1 of 6 , Sep 5, 2012
    • 0 Attachment
      --- In json@yahoogroups.com, Jonathan Wallace <ninja9578@...> wrote:

      > Libjson will parse them all, if you attempt to get the object by its key and said key is not unique, it will give you the first one. The only way to get the second would be to use an integrator and check the keys one by one. I've had a few requests to throw exceptions in the case of multiple objects with the same key, but it would break the standard.


      You can do as you like, but I think it would be better if you throw the exception.
    • Jonathan Wallace
      I will likely make it a compilation error in the next release Sent from my iPhone ... [Non-text portions of this message have been removed]
      Message 2 of 6 , Sep 6, 2012
      • 0 Attachment
        I will likely make it a compilation error in the next release

        Sent from my iPhone

        On Sep 5, 2012, at 12:28, "douglascrockford" <douglas@...> wrote:

        > --- In json@yahoogroups.com, Jonathan Wallace <ninja9578@...> wrote:
        >
        > > Libjson will parse them all, if you attempt to get the object by its key and said key is not unique, it will give you the first one. The only way to get the second would be to use an integrator and check the keys one by one. I've had a few requests to throw exceptions in the case of multiple objects with the same key, but it would break the standard.
        >
        > You can do as you like, but I think it would be better if you throw the exception.
        >
        >
        >
        >
        >
        >
        >

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