I was trying to read a bunch of JSON files in a Java class. I tried this
InputStream is = Myclass.class.getResourceAsStream("/data");
InputStreamReader in = new InputStreamReader(is);
BufferedReader b = new BufferedReader(in);
Stream<String> lines = bufferedReader.lines();
I got a Stream<String>
which contains the a bunch of Strings of the JSON file name. I got all the JSON name strings, but how can I access to each JSON, like transfer each JSON to an object or else operations
Here is my package structure
src
--MyClass.java
data
--One.json
--Two.json
--Three.json