All was working fine before but now Getting error like
Error Domain=NSCocoaErrorDomain Code=3840 "JSON text did not start with array or object and option to allow fragments not set." UserInfo={NSDebugDescription=JSON text did not start with array or object and option to allow fragments not set.}
My JSON parsing code is like
func JSONParseArray(jsonString: String) -> [AnyObject] {
if let data = jsonString.dataUsingEncoding(NSUTF8StringEncoding) {
if let array = (try? NSJSONSerialization.JSONObjectWithData(data, options: NSJSONReadingOptions(rawValue: 0))) as? [AnyObject] {
return array
}
}
print(strings)
return [AnyObject]()
}
what can be issue? or what I am doing wrong?
My JSOn String value is
http://test.domain.in/transfer/jsp/wsCall.jsp?dataFormat=JSON&requestData={"requestId":"1447417335364","requestType":"LOGIN","channelId":"MOBILE","clientId":"RG","groupId”:”Test”,”loginId":"[email protected]","password":"cFzc3dvcmRAMA==","noofAttempts":"1","ipAddress":"8ADCD445-A4F6-49EA-A344-35313A0AD","key":"MzQM3OTA4NDgxMjY4bWlsbGVy"}
http://test.domain.in/transfer/jsp/wsCall.jsp?dataFormat=JSON&requestData=causes the issue. - Midhun MPhttp://test.domain.in/transfer/jsp/wsCall.jsp?dataFormat=JSON&requestData=should not be part of your jsonString. You'll have to figure out why is it coming. - saurabh