org.json Tutorial
Selected Reading
- org.json - Discussion
- org.json - Useful Resources
- org.json - Quick Guide
- org.json - JSONException Handling
- org.json - XML
- org.json - Property
- org.json - JSONStringer
- org.json - JSONObject
- org.json - JSONML
- org.json - JSONArray
- org.json - HTTP
- org.json - CookieList
- org.json - Cookie
- org.json - CDL
- org.json - Environment Setup
- org.json - Overview
- org.json - Home
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
org.json - JSONArray
org.json - JSONArray
A JSONArray is an ordered sequence of values. It provides methods to access values by index and to put values. Following types are supported −
Boolean
JSONArray
JSONObject
Number
String
JSONObject.NULL object
Example
import org.json.JSONArray; import org.json.JSONObject; pubpc class JSONDemo { pubpc static void main(String[] args) { JSONArray pst = new JSONArray(); pst.put("foo"); pst.put(new Integer(100)); pst.put(new Double(1000.21)); pst.put(new Boolean(true)); pst.put(JSONObject.NULL); System.out.println("JSONArray: "); System.out.println(pst); } }
Output
JSONArray: ["foo",100,1000.21,true,null]Advertisements