Search in sources :

Example 46 with Json

use of siena.Json in project siena by mandubian.

the class JsonTest method testRemoveAt.

public void testRemoveAt() {
    Json json = Json.list(1, 2, 3);
    json.removeAt(1);
    assertEquals(2, json.size());
    assertEquals(1, json.at(0).asInt());
    assertEquals(3, json.at(1).asInt());
}
Also used : Json(siena.Json)

Example 47 with Json

use of siena.Json in project siena by mandubian.

the class JsonTest method testRemoveKey.

public void testRemoveKey() {
    Json json = Json.map().put("foo", "bar");
    json.remove("foo");
    assertTrue(json.isEmpty());
}
Also used : Json(siena.Json)

Example 48 with Json

use of siena.Json in project siena by mandubian.

the class JsonTest method testAddAll.

public void testAddAll() {
    Json json = Json.list(1, 2, 3);
    json.addAll(Json.list(4, 5, 6));
    assertEquals(6, json.size());
}
Also used : Json(siena.Json)

Aggregations

Json (siena.Json)48 SienaException (siena.SienaException)7 Field (java.lang.reflect.Field)6 HashMap (java.util.HashMap)4 IOException (java.io.IOException)3 ParseException (java.text.ParseException)3 Date (java.util.Date)3 Element (org.dom4j.Element)3 DecimalPrecision (siena.core.DecimalPrecision)3 BufferedReader (java.io.BufferedReader)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2 ObjectOutput (java.io.ObjectOutput)2 ObjectOutputStream (java.io.ObjectOutputStream)2 SimpleDateFormat (java.text.SimpleDateFormat)2 ArrayList (java.util.ArrayList)2 Collection (java.util.Collection)2 List (java.util.List)2 Polymorphic (siena.core.Polymorphic)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 InputStreamReader (java.io.InputStreamReader)1