refactor a certain amount of WritableJSONObject into a parent MapBasedJSONObject class to open the door to properly ImmutableJSONObject elements in the future.
expose toString(indentFactor, indent) to deal with bugs where we had an UnmodifiableJSONObject nested inside a WritableJSONObject being treated like a String when serialising the JSONObject to a String.  We now just deal with abstract JSONObjects and things behave much better.