### Question:
JohnzonJsonb implements Jsonb, AutoCloseable, JsonbExtension { @Override public <T> T fromJson(final String str, final Class<T> type) throws JsonbException { try { if (isArray(type)) { return delegate.readTypedArray(new StringReader(str), type.getComponentType(), type); } else if (JsonArray.class == type) { return (T) delegate.readJsonArray(new StringReader(str)); } else if (Collection.class.isAssignableFrom(type)) { return (T) delegate.readCollection(new StringReader(str), new JohnzonParameterizedType(type, Object.class)); } final Type mappingType = unwrapPrimitiveOptional(type); final Object object = delegate.readObject(str, mappingType); if (mappingType != type) { return wrapPrimitiveOptional(object, type); } return (T) object; } catch (final MapperException me) { throw new JsonbException(me.getMessage(), me); } } JohnzonJsonb(final Mapper build, final boolean ijson, final Consumer<JohnzonJsonb> onClose); @Override T fromJson(final String str, final Class<T> type); @Override T fromJson(final String str, final Type runtimeType); @Override T fromJson(final Reader reader, final Class<T> type); @Override T fromJson(final Reader reader, final Type runtimeType); @Override T fromJson(final InputStream stream, final Class<T> type); @Override T fromJson(final InputStream stream, final Type runtimeType); @Override String toJson(final Object inObject); @Override String toJson(final Object inObject, final Type runtimeType); @Override void toJson(final Object inObject, final Writer writer); @Override void toJson(final Object inObject, final Type runtimeType, final Writer writer); @Override void toJson(final Object inObject, final OutputStream stream); @Override void toJson(final Object inObject, final Type runtimeType, final OutputStream stream); @Override void close(); @Override T fromJsonValue(final JsonValue json, final Class<T> type); @Override JsonValue toJsonValue(final Object object); @Override T fromJsonValue(final JsonValue json, final Type type); @Override JsonValue toJsonValue(final Object rawObject, final Type runtimeType); @Override T fromJson(final JsonParser json, final Class<T> type); @Override T fromJson(final JsonParser parser, final Type runtimeType); @Override void toJson(final Object object, final JsonGenerator jsonGenerator); @Override void toJson(final Object object, final Type runtimeType, final JsonGenerator jsonGenerator);  }### Answer:
@Test public void listJsonValue() { assertEquals(Json.createValue(1.1), rule.fromJson("{\"value\":[1.1]}", ArrayJsonValueWrapper.class).value.get(0)); }
@Test public void listObject() { assertEquals(1.1, Number.class.cast( rule.fromJson("{\"value\":[1.1]}", ArrayObjectWrapper.class).value.get(0)).doubleValue(), 0); }
@Test public void jsonArray() throws Exception { try (final Jsonb jsonb = JsonbBuilder.create()) { final String json = "[{\"foo\":\"bar\"}]"; final JsonArray array = jsonb.fromJson(json, JsonArray.class); assertEquals(json, array.toString()); } }