JSON Programming Javaorg json File New Java Project
- Slides: 23
JSON Programming 使用Java+org. json套件存取開放資料
File -> New -> Java Project
JSON剖析 具的網路載點 (https: //github. com/stleary/JSON-java)
在Eclipse加入JSON剖析 具(1/2) 專案名稱->Build Path->Add External Archives
在Eclipse加入JSON剖析 具(2/2)
JSON
JSONObject for 單列資料表 { name chinese english female weight amanda 85 90 true 52. 5 } "name" : "amanda", "chinese": 85, "english" : 90, "female" : true, "weight" : 52. 5
建立JSONObject 方法(1)—應用 put() • JSONObject obj = new JSONObject(); • obj. put(param 1, param 2) • param 1 (String): 欄位名稱 • param 2 (int/double/String/boolean): 欄位值 { } "name" : "amanda", "chinese": 85, "english" : 90, "weight" : 52. 5, "female" : true
建立JSONObject 方法(2)—JSON字串作為資料來源 • JSONObject obj = new JSONObject(param); • param (String): JSON字串 { } "name" : "amanda", "chinese": 85, "english" : 90, "weight" : 52. 5, "female" : true
JSONArray for 單欄多值資料 chinese 85 77 96 82 [ 91 ] 85, 77, 96, 82, , 91,
建立JSONArray 方法(1)—應用 put() • JSONArray array = new JSONArray(); • array. put(param) • param (int/double/String/boolean): 欄位值 [ ] 85, 77, 96, 82, , 91,
建立JSONArray 方法(2)—JSON字串作為資料來源 • JSONArray array = new JSONArray(param); • param (String): JSON字串 chinese 85 77 96 82 91 請刪除 null 試試看
讀取文字檔 Scanner建構式 拋出File. Not. Found. Exception
多列資料表 name amanda bob carol chinese 85 92 83 english 90 76 94 female weight true 52. 5 false 77. 3 true
多列資料表的 JSON 表示法 [ { "name" : "amanda", "chinese": 85, "english" : 90, "female" : true, "weight" : 52. 5}, { "name" : "bob", "chinese": 92, "english" : 76, "female" : false, "weight" : 77. 3}, { "name" : "carol", "chinese": 83, "english" : 94, "female" : true, "weight" : null } ]
- File-file yang dibuat oleh user pada jenis file di linux
- Physical image vs logical image
- File sharing management system
- Distributed file system definition
- What does a markup tag tells the web browser
- In a file-oriented information system, a transaction file
- Handling files in c
- File and record locking in network programming
- Perbedaan linear programming dan integer programming
- Greedy programming vs dynamic programming
- What is system program
- Linear vs integer programming
- Perbedaan linear programming dan integer programming
- Java bytecode file
- Import java.io.*
- Java.io.file
- Java file structure
- Java file input output
- Java file input and output
- File reader java
- Java file class
- Tcp and udp socket programming in java
- Parallel programming java
- Object oriented programming java exercises