M
Malainho
Guest
Hello People
I have a problem with a Json and two Exceptions. I have two cods, The codes generate exceptions.
I can't change the json. He came Webservice.
i have manipulate the variable resposta to not have problem.
1º Code:
Dim resposta As String ="{"SUCCESS":0,"IDERRO":1,"ERRO":"O CAMPO NOME \U00E9 OBRIGAT\U00F3RIO"}"
Dim obj As Object = New JavaScriptSerializer().Deserialize(Of MensagemErro)(resposta.toString())
This code generate this exception: SYSTEM.ARGUMENTEXCEPTION: 'ESCAPE SEQUENCE NOT RECOGNIZED.. (48):
2º Code:
Dim resposta As String ="{"SUCCESS":0,"IDERRO":1,"ERRO":"O CAMPO NOME \U00E9 OBRIGAT\U00F3RIO"}"
Dim stream = New MemoryStream(Encoding.UTF8.GetBytes(resposta.ToString()))
Dim obj As Object = New JavaScriptSerializer().Deserialize(Of MensagemErro)(stream.toString())
This code generate this exception: System.ArgumentException: 'Invalid JSON primitive: System.IO.MemoryStream.'
Help me to solve this problem, please.
Thank you
Continue reading...
I have a problem with a Json and two Exceptions. I have two cods, The codes generate exceptions.
I can't change the json. He came Webservice.
i have manipulate the variable resposta to not have problem.
1º Code:
Dim resposta As String ="{"SUCCESS":0,"IDERRO":1,"ERRO":"O CAMPO NOME \U00E9 OBRIGAT\U00F3RIO"}"
Dim obj As Object = New JavaScriptSerializer().Deserialize(Of MensagemErro)(resposta.toString())
This code generate this exception: SYSTEM.ARGUMENTEXCEPTION: 'ESCAPE SEQUENCE NOT RECOGNIZED.. (48):
2º Code:
Dim resposta As String ="{"SUCCESS":0,"IDERRO":1,"ERRO":"O CAMPO NOME \U00E9 OBRIGAT\U00F3RIO"}"
Dim stream = New MemoryStream(Encoding.UTF8.GetBytes(resposta.ToString()))
Dim obj As Object = New JavaScriptSerializer().Deserialize(Of MensagemErro)(stream.toString())
This code generate this exception: System.ArgumentException: 'Invalid JSON primitive: System.IO.MemoryStream.'
Help me to solve this problem, please.
Thank you
Continue reading...