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

Re: [json] java/org.json.JSONString

Expand Messages
  • Mark Miller
    ... This seems like a dangerous masking of errors. If these conditions occur, I would think the error should propagate, and the serialization to JSON should
    Message 1 of 3 , Jun 3 9:41 PM
    • 0 Attachment
      Douglas Crockford wrote:
      > I have added a JSONString interface. A class implementing it can
      > customize the JSON serialization of its instances.
      >
      > http://www.json.org/java/index.html

      On that page:
      > If toJSONString throws any exception, or returns a non-string result, then
      > the string value will be obtained the default way.

      This seems like a dangerous masking of errors. If these conditions occur,
      I would think the error should propagate, and the serialization to JSON should
      fail. What am I missing?

      --
      Text by me above is hereby placed in the public domain

      Cheers,
      --MarkM
    • Douglas Crockford
      ... result, then ... occur, ... JSON should You are right. It should throw a JSONException instead.
      Message 2 of 3 , Jun 4 5:43 AM
      • 0 Attachment
        > > I have added a JSONString interface. A class implementing it can
        > > customize the JSON serialization of its instances.
        > >
        > > http://www.json.org/java/index.html
        >
        > On that page:
        > > If toJSONString throws any exception, or returns a non-string
        result, then
        > > the string value will be obtained the default way.
        >
        > This seems like a dangerous masking of errors. If these conditions
        occur,
        > I would think the error should propagate, and the serialization to
        JSON should

        You are right. It should throw a JSONException instead.
      Your message has been successfully submitted and would be delivered to recipients shortly.