org.json.JSONException: Unterminated object at character

riccio99

New Member
Licensed User
Longtime User
Hi all.

In the app i'm developing i have this error:
main_hc_responsesuccess (B4A line: 84)
l = parser.NextArray
org.json.JSONException: Unterminated object at character 20 of [{MESSAGGIO:Sergio Sbracia}]

if i wrote:
[{MESSAGGIO:Sergio}]

it works.

Why i have that error if [{MESSAGGIO:Sergio Sbracia}] ?

THIS IS THE CODE:
Dim l As List
l = parser.NextArray
If l.Size = 0 Then
Msgbox("Utente non riconosciuto","Errore")
Else
Dim m As Map
m = l.Get(0)
Select M.Get("MESSAGGIO")
Case 1
Msgbox("Nome utente/password errati","Accesso negato")
Case 2
Msgbox("Controlla le maiuscole/minuscole","Accesso negato")
Case Else
Msgbox(m.Get("MESSAGGIO"),"ACCESSO EFFETTUATO")
End Select
ProgressDialogHide
End If

THX TO ALL.
 

riccio99

New Member
Licensed User
Longtime User
JSON strings should be quoted: [{MESSAGGIO:"Sergio Sbracia"}]

thank you! now it works :)

p.s.

the app take the response from aspx page that write out some variables to it was difficult to add doble quotes to string but now here it is

Response.Write ("[{MESSAGGIO:"""&TRIM(session("user"))&"""}]")

could be useful to someone else :)
 
Upvote 0
Top