Cocoa Error 3840 - NSJSONSerialization

后端 未结 2 613
萌比男神i
萌比男神i 2020-12-22 04:57

I\'m trying to parse a JSON string returned from a ASP.NET web service. The return string has been simplified to just this:



        
相关标签:
2条回答
  • 2020-12-22 05:19

    Try this hope it will work

    if ([operation isKindOfClass:[AFJSONRequestOperation class]] && [operation respondsToSelector:@selector(setJSONReadingOptions:)]) {
        ((AFJSONRequestOperation *)operation).JSONReadingOptions = NSJSONReadingAllowFragments;
    }
    [httpClient enqueueHTTPRequestOperation:operation];
    
    0 讨论(0)
  • 2020-12-22 05:29

    Is the Web service actually returning the <anyType d1p1:type="q1:string"> and </anyType> portions of that string within the content of the document? If so, that's the problem: The valid JSON string is simply:

    [{"Firstname":"Johnny"}],

    This is the only content your Web response should contain. Everything in angled brackets is not actually JSON data, and it's throwing the parser off.

    0 讨论(0)
提交回复
热议问题