Skip to content
This repository has been archived by the owner on Oct 4, 2022. It is now read-only.

JSONFileReaderUtility to read JSON files #2111

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions Java/Algorithms/Utility/JSONFileReaderUtility.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;

public class JSONFileReaderUtility {

public static void main(String[] args) throws Exception {
String filePath = "../Resources/SampleJSON.json";
String response = readJSONFile(filePath);
System.out.println(response);
}

public static String readJSONFile(String filePath) throws IOException {
return new String(Files.readAllBytes(Paths.get(filePath)));
}
}