[JSON_PROCESSING_SPEC-39] JSON API renaming: s/JsonArray/JsonList and s/JsonObject/JsonMap Created: 11/Dec/12  Updated: 13/Dec/12  Resolved: 13/Dec/12

Status: Resolved
Project: json-processing-spec
Component/s: None
Affects Version/s: 1.0-pr
Fix Version/s: 1.0-pr

Type: Improvement Priority: Major
Reporter: jitu Assignee: jitu
Resolution: Won't Fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 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.
-------------



 Comments   
Comment by jitu [ 11/Dec/12 ]

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.
Comment by jitu [ 13/Dec/12 ]

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

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

Generated at Sun Jul 05 15:01:27 UTC 2015 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.