json-processing-spec
  1. json-processing-spec
  2. JSON_PROCESSING_SPEC-39

JSON API renaming: s/JsonArray/JsonList and s/JsonObject/JsonMap

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: 1.0-pr
    • Fix Version/s: 1.0-pr
    • Labels:
      None

      Description

      Mark Reinhold's feedback
      -------------------------
      Looking at this API in depth for the first time, I kept getting confused
      by the name "JsonObject".

      In Java terms, what JSON calls an "Object" is just a map, from strings to
      JSON values. Java already uses "Object" as the unifying supertype of all
      types, so I'd expect "JsonObject" to unify (some set of) JSON-specific
      value types.

      This suggests a renaming along these lines:

      JsonObject --> JsonMap
      JsonObjectBuilder --> JsonMapBuilder
      JsonStructure --> JsonObject

      I think Java developers would find this more natural, since most will
      never read the actual JSON specification.

      Remember that this API is for Java developers, not readers of the JSON
      specification.
      -------------

        Activity

        Hide
        jitu added a comment -

        I received the same feedback from Brian Goetz earlier. But some libraries are already using JsonObject and JsonArray, so we continued that naming. But this API is for Java developers, so we should follow what is suggested by Mark and Brian.

        This would also mean we need to change in other places

        JsonArray --> JsonList
        JsonArrayBuilder --> JsonListBuilder

        • JsonReader and JsonWriter changes
          s/readArray/readList
          s/readObject/readMap

        s/writeArray/writeList
        s/writeObject/writeMap

        • JsonGenerator
          s/writeStartArray/writeStartList
          s/writeStartObject/writeStartMap
        • We have events (like START_ARRAY etc) in the JsonParser. Those need to be changed to START_LIST etc
        • ValueType has ARRAY and OBJECT, those will be changed to LIST and MAP.
        Show
        jitu added a comment - I received the same feedback from Brian Goetz earlier. But some libraries are already using JsonObject and JsonArray, so we continued that naming. But this API is for Java developers, so we should follow what is suggested by Mark and Brian. This would also mean we need to change in other places JsonArray --> JsonList JsonArrayBuilder --> JsonListBuilder JsonReader and JsonWriter changes s/readArray/readList s/readObject/readMap s/writeArray/writeList s/writeObject/writeMap JsonGenerator s/writeStartArray/writeStartList s/writeStartObject/writeStartMap We have events (like START_ARRAY etc) in the JsonParser. Those need to be changed to START_LIST etc ValueType has ARRAY and OBJECT, those will be changed to LIST and MAP.
        Hide
        jitu added a comment -

        http://java.net/projects/json-processing-spec/lists/users/archive/2012-12/message/75

        Based on the discussion, resolving this one with no action.

        Show
        jitu added a comment - http://java.net/projects/json-processing-spec/lists/users/archive/2012-12/message/75 Based on the discussion, resolving this one with no action.

          People

          • Assignee:
            jitu
            Reporter:
            jitu
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: