### Question:
JSONBundleizer extends NewlineBundleizer { @Override public Bundle bundleize(Bundle next, String line) { try { Bundle bundle = codec.decodeObject(Bundle.class, line); Bundles.addAll(bundle, next, true); return next; } catch (IOException ex) { throw new UncheckedIOException(ex); } }  @Override Bundle bundleize(Bundle next, String line);  }### Answer:
@Test public void jsonToBundle() throws Exception { JSONBundleizer bundleizer = decodeObject(JSONBundleizer.class, "{type: json}"); String json = "{\"time\": 100, \"uid\":\"freddy\"}"; Bundle bundle = bundleizer.bundleize(new ListBundle(), json); AutoField time = AutoField.newAutoField("time"); AutoField uid = AutoField.newAutoField("uid"); Assert.assertEquals(100, time.getInt(bundle).getAsInt()); Assert.assertEquals("freddy", uid.getString(bundle).get()); }
@Test public void ignoreTypeField() throws Exception { JSONBundleizer bundleizer = decodeObject(JSONBundleizer.class, "{type: json}"); String json = "{\"time\": 100, \"uid\":\"freddy\", \"type\": \"notABundleType\"}"; Bundle bundle = bundleizer.bundleize(new ListBundle(), json); AutoField time = AutoField.newAutoField("time"); AutoField uid = AutoField.newAutoField("uid"); AutoField type = AutoField.newAutoField("type"); Assert.assertEquals(100, time.getInt(bundle).getAsInt()); Assert.assertEquals("freddy", uid.getString(bundle).get()); Assert.assertEquals("notABundleType", type.getString(bundle).get()); }