Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bhaskarkatara/howtoaccessdatafromjsonfileinandroidjc
In this repo, i share how to access json data from json file , this repo is not completed yet
https://github.com/bhaskarkatara/howtoaccessdatafromjsonfileinandroidjc
android-application jetpack-compose json kotlin-android
Last synced: 7 days ago
JSON representation
In this repo, i share how to access json data from json file , this repo is not completed yet
- Host: GitHub
- URL: https://github.com/bhaskarkatara/howtoaccessdatafromjsonfileinandroidjc
- Owner: bhaskarkatara
- Created: 2024-06-09T11:27:07.000Z (5 months ago)
- Default Branch: master
- Last Pushed: 2024-06-10T03:54:09.000Z (5 months ago)
- Last Synced: 2024-06-10T04:47:34.229Z (5 months ago)
- Topics: android-application, jetpack-compose, json, kotlin-android
- Language: Kotlin
- Homepage:
- Size: 95.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Step 1: Create the JSON File
1.Create a res/raw directory:Right-click on the res folder -> New -> Android Resource Directory.
Set the Resource Type to raw and name the directory raw.
2.Add JSON file:Create a JSON file (e.g., data.json) in the res/raw directory.
Example content for data.json:
data.json
[
{"id": 1, "name": "Alice", "age": 30},
{"id": 2, "name": "Bob", "age": 25},
{"id": 3, "name": "Charlie", "age": 35}
]#ADD DEPENDENCIES
1. Go to Gradle Scripts -> build.gradles.kts -> dependencies
2. implementation(libs.gson) --> in jetpack Compose format
3. implementation 'com.google.code.gson:gson:2.8.6' -> in Xml format