Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zainfikrih/jsonloader-library
📱 Android library to open JSON from assets
https://github.com/zainfikrih/jsonloader-library
android android-library library
Last synced: 5 days ago
JSON representation
📱 Android library to open JSON from assets
- Host: GitHub
- URL: https://github.com/zainfikrih/jsonloader-library
- Owner: zainfikrih
- License: apache-2.0
- Created: 2019-10-18T15:26:53.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2020-01-31T01:47:12.000Z (almost 5 years ago)
- Last Synced: 2024-08-01T21:47:24.586Z (3 months ago)
- Topics: android, android-library, library
- Language: Java
- Homepage:
- Size: 180 KB
- Stars: 30
- Watchers: 2
- Forks: 8
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-android - jsonloader-library - Android library to open JSON from assets. (Uncategorized / Uncategorized)
README
[![](https://jitpack.io/v/zainfikrih/jsonloader-library.svg)](https://jitpack.io/#zainfikrih/jsonloader-library)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/ab5f6e4c77a0474280b46883ce17092b)](https://www.codacy.com/manual/zainfikrih/jsonloader-library?utm_source=github.com&utm_medium=referral&utm_content=zainfikrih/jsonloader-library&utm_campaign=Badge_Grade)
[![HitCount](http://hits.dwyl.io/zainfikrih/jsonloader-library.svg)](http://hits.dwyl.io/zainfikrih/jsonloader-library)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-JSONLoader%20Library-orange.svg?style=flat)](https://android-arsenal.com/details/1/7916)# JSONLoader Library
![Imgur](https://i.imgur.com/xczU7nd.png)
A simple Android library to open JSON from assets## Download
Latest Version: [![Latest Vesrion](https://jitpack.io/v/zainfikrih/jsonloader-library.svg)](https://jitpack.io/#zainfikrih/jsonloader-library)Grab the latest dependencies through Gradle, add it to your build.gradle with:
```gradle
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
```
and:```gradle
dependencies {
implementation 'com.github.zainfikrih:jsonloader-library:{latest version}'
}
```## Usage
Put the json file in the assets package on the android project (src / main / assets / filename.json).
For more information, see [Where do I place the 'assets' folder in Android Studio?](https://stackoverflow.com/questions/18302603/where-do-i-place-the-assets-folder-in-android-studio)Get JSON as a string:
```java
JSONLoader.with(getApplicationContext())
.fileName("filename.json")
.get(new StringLoaderListener() {
@Override
public void onResponse(String response) {
// response as String
}@Override
public void onFailure(IOException error) {
// error
}
});
```Get JSON as JSON Object:
```java
JSONLoader.with(getApplicationContext())
.fileName("filename.json")
.getAsJSONObject(new JSONObjectLoaderListener() {
@Override
public void onResponse(JSONObject response) {
// response as JSONObject
}@Override
public void onFailure(Exception error) {
// error
}
});
```Get JSON as JSON Array:
```java
JSONLoader.with(getApplicationContext())
.fileName("filename.json")
.getAsJSONArray(new JSONArrayLoaderListener() {
@Override
public void onResponse(JSONArray response) {
// response ad JSONArray
}@Override
public void onFailure(Exception error) {
// error
}
});
```For some examples, see the sample App.
## License
```license
Copyright 2019 Zain Fikri HLicensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```