JsonResource extends ResourceFilter { @Override public LanguageBundle parse(InputStream inStream, FilterOptions options) throws IOException, ResourceFilterException { LanguageBundleBuilder bb = new LanguageBundleBuilder(false); try (InputStreamReader reader = new InputStreamReader(new BomInputStream(inStream), StandardCharsets.UTF_8)) { JsonElement root = new JsonParser().parse(reader); if (!root.isJsonObject()) { throw new IllegalResourceFormatException("The root JSON element is not an JSON object."); } addBundleStrings(root.getAsJsonObject(), "", bb, 0); } catch (JsonParseException e) { throw new IllegalResourceFormatException("Failed to parse the specified JSON contents.", e); } return bb.build(); }  @Override LanguageBundle parse(InputStream inStream, FilterOptions options); @Override void write(OutputStream outStream, LanguageBundle languageBundle,
            FilterOptions options);  }
@Test public void testParse() throws IOException, ResourceFilterException { assertTrue("The input test file <" + INPUT_FILE + "> does not exist.", INPUT_FILE.exists()); try (InputStream is = new FileInputStream(INPUT_FILE)) { LanguageBundle bundle = res.parse(is, null); List<ResourceString> resStrList = new ArrayList<>(bundle.getResourceStrings()); Collections.sort(resStrList, new ResourceStringComparator()); assertArrayEquals("ResourceStrings did not match.", EXPECTED_INPUT_RES_LIST.toArray(), resStrList.toArray()); } }