Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import org.json.JSONException;
- import org.json.JSONStringer;
- import org.json.JSONWriter;
- public class Prueba {
- public static void main(String args[]) throws JSONException{
- JSONWriter json = new JSONStringer().array();
- json = json.object()
- .key("Fecha").value("2009-02-11")
- .key("Nombre").value("Elemento")
- .key("Informe").value(true)
- .endObject();
- json = json.object()
- .key("[\"Escape\"]").value(true)
- .key("Descripción").value("\\/\"][][{}{}{}{}")
- .endObject();
- json = json.endArray();
- System.out.println(json.toString());
- }
- }
- ##Salida
- [{"Fecha":"2009-02-11","Nombre":"Elemento","Informe":true},{"[\"Escape\"]":true,"Descripción":"\\/\"][][{}{}{}{}"}]
Advertisement
Add Comment
Please, Sign In to add comment