Made the getJson method rely on json_last_error() to detect valid JSON (safer)
Add tests for empty arrays