Guest User

Untitled

a guest
Feb 13th, 2012
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. import org.json.JSONException;
  2. import org.json.JSONStringer;
  3. import org.json.JSONWriter;
  4.  
  5.  
  6. public class Prueba {
  7. public static void main(String args[]) throws JSONException{
  8. JSONWriter json = new JSONStringer().array();
  9.  
  10. json = json.object()
  11. .key("Fecha").value("2009-02-11")
  12. .key("Nombre").value("Elemento")
  13. .key("Informe").value(true)
  14. .endObject();
  15.  
  16.  
  17. json = json.object()
  18. .key("[\"Escape\"]").value(true)
  19. .key("Descripción").value("\\/\"][][{}{}{}{}")
  20. .endObject();
  21.  
  22. json = json.endArray();
  23.  
  24. System.out.println(json.toString());
  25. }
  26. }
  27.  
  28. ##Salida
  29.  
  30. [{"Fecha":"2009-02-11","Nombre":"Elemento","Informe":true},{"[\"Escape\"]":true,"Descripción":"\\/\"][][{}{}{}{}"}]
Advertisement
Add Comment
Please, Sign In to add comment