JSON Value failed - iphone

I am fetching data from server into my iPhone app.
But it shows the exception
-JSONValue failed. Error trace is: (
"Error Domain=org.brautaset.JSON.ErrorDomain Code=4 \"Valid fragment, but not JSON\" UserInfo=0x6e9b460 {NSLocalizedDescription=Valid fragment, but not JSON}"
Any Solution.

Check your data should be in this format use http://jsonformatter.curiousconcept.com/ to check the json format

Related

How to find out what i'm doing wrong. Getting validation exception in timestream write Records with go sdk?

As the title says, I'm trying to write a bunch of records to timestream, but I keep getting "ValidationException" without any further information, so I have no idea what should be fixed. The exact error response is:
operation error Timestream Write: WriteRecords, https response error StatusCode: 400, RequestID: XXXXXXXXXXXXXX, ValidationException:
It made me think that it was a multiline string and somehow the logging framework wasn't logging properly, but I tried splitting by \n and all I got was a size 1 list with the same text.
Any ideas?
For some reason, the validation error is wrapped multiple errors deep. To get to the validation error message, you need the following:
import (
"fmt"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/aws/transport/http"
"github.com/aws/aws-sdk-go-v2/service/timestreamwrite/types"
"github.com/aws/smithy-go"
)
responseError := err.(*smithy.OperationError).Unwrap().(*http.ResponseError)
validationError := responseError.Unwrap().(*types.ValidationException)
fmt.Println(validationError.ErrorMessage())

XMLParser error in objective c, Start tag expected, '<' not found?

in my application i tried to send a web service request in the NSString format. i used sudzc to generate web service . but, when i send the request, i got an error showing
Entity: line 1: parser error : Start tag expected, '<' not found
Bad Request
Error Domain=CXMLErrorDomain Code=1 "The operation couldn’t be completed. (CXMLErrorDomain error 1.)"^
here is my sending string which is in xml format,,
NSString *string=[NSString stringWithString:#"<request><ClosingDate>06-Sep-2012</ClosingDate><ProductName>Document Management Software</ProductName><ProductID>3</ProductID><CurrencyID>3</CurrencyID></request>"];
but the error shows '<' not found,
i dont know exactly what the error is?
need some help
EDIT
I USED SUDZC TO GENERATE WEB SERVICE
MFLCommonServices *services1=[MFLCommonServices service];
NSString *request=[NSString stringWithString:#"<request><ClosingDate>06-Sep-2012</ClosingDate><ProductName>Document Management Software</ProductName><ProductID>3</ProductID><CurrencyID>3</CurrencyID></request>"];
[services1 CreateRequest:self action:#selector(CreateRequestHandler:) Email:#"xxxxx" Password:#"xxxxxx" Token:#"xxxxxx" Request:request];

iphone : error parsing XML: Unable to read response xml (Error code 5 )

I am using XMLParsing for using my webservice in iphone app.
and i am getting error parsing XML: Unable to read response xml (Error code 5 )
What is wrong?
NSXMLParserPrematureDocumentEndError
The document ended unexpectedly.
Available in Mac OS X v10.3 and later.
Declared in NSXMLParser.h.
The problem looks like your xml is not well formed. So debug on these lines and you will be able to parse the xml successfully.
Check the format of the request u r sending. Or look into this.
http://www.iphonedevsdk.com/forum/iphone-sdk-development/37597-parsing-xml-return-error-code-5-but-url-correct.html
The sixth comment says he has solved the problem.
The following link gives all the error constants
http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSXMLParser_Class/Reference/Reference.html

zend header already send problem

sometimes i got error when i include your class(AuthnetCim.class) in my controller.
the error is as below:-
Fatal error: Uncaught exception
‘Zend_Controller_Response_Exception’
with message ‘Cannot send headers;
headers already sent in
/home/newwebsi/public_html/B4BPHP/public/include/AuthnetCIM.class.php,
line 1′ in
/home/newwebsi/public_html/B4BPHP/library/Zend/Controller/Response/Abstract.php:321
Stack trace: #0
/home/newwebsi/public_html/B4BPHP/library/Zend/Controller/Response/Abstract.php(148):
Zend_Controller_Response_Abstract->canSendHeaders(true)
#1 /home/newwebsi/public_html/B4BPHP/library/Zend/Controller/Action/Helper/Redirector.php(226):
Zend_Controller_Response_Abstract->setRedirect(‘/B4BPHP/public/…’,
302) #2
/home/newwebsi/public_html/B4BPHP/library/Zend/Controller/Action/Helper/Redirector.php(370):
Zend_Controller_Action_Helper_Redirector->_redirect(‘/B4BPHP/public/…’)
#3 /home/newwebsi/public_html/B4BPHP/library/Zend/Controller/Action/Helper/Redirector.php(453):
Zend_Controller_Action_Helper_Redirector->setGotoUrl(‘index/login’, Array) #4
/home/newwebsi/public_html/B4BPHP/library/Zend/Controller/Action.php(68
in
/home/newwebsi/public_html/B4BPHP/library/Zend/Controller/Response/Abstract.php
on line 321
when i remove this class i do not get any error anywhere
Please, help me to resolve this error
Make sure you do not have any characters before <?php in AuthnetCIM.class.php.
Ouput is sent to the browser when the file AuthnetCIM.class.php is looked-up/included.
Check for spaces, BOM before the opening PHP tag, echoing/printing statements.
In other words check for anything that might be causing the script to output data.

JSON Parsing Error?

I am using JSON (SBJson) but it's giving the error :
JSONValue failed. Error trace is: (
"Error Domain=org.brautaset.JSON.ErrorDomain Code=3 \"Unrecognised leading character\" UserInfo=0x5f2f7f0 {NSLocalizedDescription=Unrecognised leading character}.
am using this web service : "http://xoap.weather.com/search/search?where=India"
please give me the solutions why does error come?
That URL returns XML, not JSON. The "illegal character" is the first bracket in the XML, which isn't a valid character in JSON.
That response is XML (application/xml), not JSON (application/json).