-
Notifications
You must be signed in to change notification settings - Fork 1
/
Main.java
27 lines (25 loc) · 788 Bytes
/
Main.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.Iterator;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
public class Main {
public static void main(String[] args) {
JSONParser parser = new JSONParser();
try {
Object parseObject = parser.parse(new FileReader("CookData.json"));
JSONObject jsonObject = (JSONObject)parseObject;
String recipeName = (String)jsonObject.get("RecipeName");
System.out.println(recipeName);
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (ParseException e) {
e.printStackTrace();
}
}
}