I'm trying to send a .json
file created within Angular to a server, and gives this error in response:
"A JSONObject text must begin with '{' at 1 [character 2 line 1]", object_or_array: "object", error_info: "This error came from the org.json reference parser.", validate: false} "
You're just going to URL, without JSON, by the way. Here is the code, made in angular:
var json={
usuario : this.nome,
senha : this.senha
};
var myJson=JSON.stringify(json);
console.log(json);
return this.http.post(this.url,JSON.stringify(json))
.map(res=> res.json())
.subscribe(data =>{
console.log(data);
});