Force an array using accumulate (even if there is only one item) #84
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I don't know if anyone wants this (or whether it violates JSON standards) but I've found that when I use JSONObject.accumulate I want to force an array object. This saves from having to write checking code on the client side to see if the item is an object or an array. You can just iterate over it the same way (because sometimes collections only have one item).
If there is a better way to handle this, please let me know.
In any case, this mod does it, but I suspect this function may have been written this way on purpose. Anyway, I love and depend on this library so thanks for keeping it maintained.