JsonHash extends LinkedHashMap<String, Object> { @Deprecated public Object put(String key, Object value, State state) { return put(key, value, Type.from(state)); }  static JsonHash fromString(String json); static JsonHash fromParser(JsonPullParser parser); void toJson(Writer writer); @Override void clear(); @Override Object clone(); @Deprecated State getState(String key); Type getType(String key); Boolean getBooleanOrNull(String key); String getStringOrNull(String key); Long getLongOrNull(String key); Double getDoubleOrNull(String key); JsonHash getJsonHashOrNull(String key); JsonArray getJsonArrayOrNull(String key); @Deprecated Object put(String key, Object value, State state); Object put(String key, Object value, Type type); Object put(String key, String value); Object put(String key, Boolean value); Object put(String key, Double value); Object put(String key, Float value); Object put(String key, Byte value); Object put(String key, Short value); Object put(String key, Integer value); Object put(String key, Long value); Object put(String key, JsonArray value); Object put(String key, JsonHash value); @Override Object put(String key, Object value); @Override void putAll(Map<? extends String, ? extends Object> map); @Override Object remove(Object obj); @Override boolean equals(Object obj); @Override String toString();  }
@Test public void put() { JsonHash jsonHash = new JsonHash(); jsonHash.put("null", (Object) null); jsonHash.put("string", "str"); jsonHash.put("boolean", true); jsonHash.put("double", 1.1); jsonHash.put("float", 1.1f); jsonHash.put("byte", (byte) 1); jsonHash.put("short", (short) 1); jsonHash.put("int", 1); jsonHash.put("long", 1L); jsonHash.put("array", new JsonArray()); jsonHash.put("hash", new JsonHash()); assertThat(jsonHash.getType("null"), is(Type.NULL)); assertThat(jsonHash.getType("string"), is(Type.STRING)); assertThat(jsonHash.getType("boolean"), is(Type.BOOLEAN)); assertThat(jsonHash.getType("double"), is(Type.DOUBLE)); assertThat(jsonHash.getType("float"), is(Type.DOUBLE)); assertThat(jsonHash.getType("byte"), is(Type.LONG)); assertThat(jsonHash.getType("short"), is(Type.LONG)); assertThat(jsonHash.getType("int"), is(Type.LONG)); assertThat(jsonHash.getType("long"), is(Type.LONG)); assertThat(jsonHash.getType("array"), is(Type.ARRAY)); assertThat(jsonHash.getType("hash"), is(Type.HASH)); jsonHash.clear(); jsonHash.put("null", (Object) null); jsonHash.put("string", (String) null); jsonHash.put("boolean", (Boolean) null); jsonHash.put("double", (Double) null); jsonHash.put("float", (Float) null); jsonHash.put("byte", (Byte) null); jsonHash.put("short", (Short) null); jsonHash.put("int", (Integer) null); jsonHash.put("long", (Long) null); jsonHash.put("array", (JsonArray) null); jsonHash.put("hash", (JsonHash) null); assertThat(jsonHash.getType("null"), is(Type.NULL)); assertThat(jsonHash.getType("string"), is(Type.NULL)); assertThat(jsonHash.getType("boolean"), is(Type.NULL)); assertThat(jsonHash.getType("double"), is(Type.NULL)); assertThat(jsonHash.getType("float"), is(Type.NULL)); assertThat(jsonHash.getType("byte"), is(Type.NULL)); assertThat(jsonHash.getType("short"), is(Type.NULL)); assertThat(jsonHash.getType("int"), is(Type.NULL)); assertThat(jsonHash.getType("long"), is(Type.NULL)); assertThat(jsonHash.getType("array"), is(Type.NULL)); assertThat(jsonHash.getType("hash"), is(Type.NULL)); }