Hacer un POST de un JSONObject
Publicado por Luis David (11 intervenciones) el 10/01/2019 17:23:16
Tengo un jsonobject con atributos y tengo un jsonserver local, de que manera puedo realizar un post para guardar ese objeto en el servidor.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
try {
jsonObject.put("author",noticia.getAuthor());
jsonObject.put("title",noticia.getTitle());
jsonObject.put("description", noticia.getDescription());
jsonObject.put("url", noticia.getUrl());
jsonObject.put("urlToImage",noticia.getUrlToImage());
jsonObject.put("publishedAt",noticia.getFormatPublishedAt());
}catch (JSONException e){
e.printStackTrace();
}
final String result = jsonObject.toString();
System.out.println(result);
Valora esta pregunta


0