-
-
Notifications
You must be signed in to change notification settings - Fork 735
Prevent JSONObject/Array + Map/List combinations and unnecessary conversions back and forth #305
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
LGTM. Consistency + Performance ftw |
…ersions back and forth We have a bunch of cases where we combine `JSONObject`/`JSONArray` and `Map`/`List` and a bunch of cases where unnecessarily convert `JSONObject` <-> `Map` and `JSONArray` <-> `List` back and forth. This PR simplifies things by removing `JSONObject` and `JSONArray` encoding so that we don't unnecessarily combine or convert back and forth. * Make encoding JSONObject/JSONArray illegal as we shouldn't be utilizing JSONObject/Array before encoding. * Encode JSONObject/Array on `ParseObject.put(key, value)` * Do not combine Map & JSONObject for ParsePush - `ParsePush#setData(data)` already accepts `JSONObject` parameter so we shouldn't use `Map<String ?>` to generate REST parameters that contain the `JSONObject` parameter just to convert it back to `JSONObject` * Do not combine JSONObject/Array with Map/List for ParseRESTObjectBatchCommand * Do not convert Map -> JSONObject -> Map -> JSONObject for ParseAnalytics * Simplify ParseConfig tests to utilize Maps/Lists - No reason to convert JSONObject/JSONArray <-> Map/List * Convert ParseConfig JSON constructor to factory method
7c4f2b3
to
cf58d03
Compare
Prevent JSONObject/Array + Map/List combinations and unnecessary conversions back and forth
By analyzing the blame information on this pull request, we identified @grantland and @wangmengyan95 to be potential reviewers. |
This change broke backwards compatibility on CloudFunction calls when I was updating my app from 1.10.3 -- the values in the second argument of What is the blessed way for encoding complex objects going forward? Is there a simple answer (e.g. "use |
@grantland curious if there is a good response to my question above. Thanks! |
@yuzeh I'd recommend using Java types such as |
Great, thanks! |
@grantland updated the pull request. |
We have a bunch of cases where we combine
JSONObject
/JSONArray
andMap
/List
and a bunch of cases where unnecessarily convertJSONObject
<->Map
andJSONArray
<->List
back and forth. This PR simplifies things by removingJSONObject
andJSONArray
encoding so that we don't unnecessarily combine or convert back and forth.Note: This breaks compatibility with ParseCrashReporting
Depends on #303