What are differences between Bundle and JSONObject in Android development? What are differences between Bundle and JSONObject in Android development? json json

What are differences between Bundle and JSONObject in Android development?


In android, Bundle is associated with fragment/activity/Service/BroadcastReceiver. It is used to send data from one activity/fragment to another. we can send data through JSONObject too but we need medium to transfer data either common filesystem or local db or bundle. Bundle is a key value pair data structure as well as a medium. JSONObject is mostly used in web apis and to serialize Objects.


The are used in different cases. Bundle is used to transfer data between Activities, while JSONObject is used to contain JSON data and manipulate that same data. You can not pass directly a JSONObject to Activity, thus you need to us a Bundle.