Added tests, refactored, and added comments

Added tests for JSONArraysToURLRequest.
Refactored JSONArraysToURLRequest to make it more testable
Added comments to JSONArraysToURLRequest to explain what each function
does.