All Projects → 100rabhkr → GetJSON

100rabhkr / GetJSON

Licence: MIT license
GetJson is the simplest HTTP library to Receive JSON Data from REST Service.

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to GetJSON

Json Apis With Github
🔨 Tool to make Simple and Quick JSON APIs with GitHub.
Stars: ✭ 240 (+1233.33%)
Mutual labels:  json-api
druxt.js
The Fully Decoupled Drupal Framework
Stars: ✭ 96 (+433.33%)
Mutual labels:  json-api
jsonapi-serializable
Conveniently build and efficiently render JSON API resources.
Stars: ✭ 43 (+138.89%)
Mutual labels:  json-api
Api Generator
PHP-code generator for Laravel framework, with complete support of JSON-API data format
Stars: ✭ 244 (+1255.56%)
Mutual labels:  json-api
rest-api
Laravel restfull api boilerplate
Stars: ✭ 57 (+216.67%)
Mutual labels:  json-api
drupal-jsonapi-params
A package to manage json-api params
Stars: ✭ 42 (+133.33%)
Mutual labels:  json-api
Crnk Framework
JSON API library for Java
Stars: ✭ 234 (+1200%)
Mutual labels:  json-api
ck-analytics
Collective Knowledge repository with actions to unify the access to different predictive analytics engines (scipy, R, DNN) from software, command line and web-services via CK JSON API:
Stars: ✭ 35 (+94.44%)
Mutual labels:  json-api
direct-net-share
share internet via Wifi direct on Android
Stars: ✭ 36 (+100%)
Mutual labels:  internet-connection
JsonApiBundle
Integration of JSON API with Symfony using JMS Serializer
Stars: ✭ 56 (+211.11%)
Mutual labels:  json-api
Hotels server
酒店预订系统后台管理系统
Stars: ✭ 249 (+1283.33%)
Mutual labels:  json-api
Intrusion Detection
Whenever founds internet connectivity confirms is it you, if not log you off and send you image of intruder.
Stars: ✭ 24 (+33.33%)
Mutual labels:  internet-connection
xijs
A business - oriented scene Js Library
Stars: ✭ 91 (+405.56%)
Mutual labels:  json-api
Jsonapi Rails
Rails gem for fast jsonapi-compliant APIs.
Stars: ✭ 242 (+1244.44%)
Mutual labels:  json-api
BindToInterface
With this program you can bind applications to a specific network interface / network adapter. This is very useful if you have multiple (internet) connections and want your program to use a specific one.
Stars: ✭ 67 (+272.22%)
Mutual labels:  internet-connection
Iotwifi
Raspberry Pi (arm) wifi configuration container. Configure and control wifi connectivity with a JSON based REST api.
Stars: ✭ 236 (+1211.11%)
Mutual labels:  json-api
fn
No description or website provided.
Stars: ✭ 28 (+55.56%)
Mutual labels:  json-api
fire
An idiomatic micro-framework for building Ember.js compatible APIs with Go.
Stars: ✭ 56 (+211.11%)
Mutual labels:  json-api
json-api
Framework agnostic JSON API serialisation and deserialisation
Stars: ✭ 40 (+122.22%)
Mutual labels:  json-api
php-serializer
Serialize PHP variables, including objects, in any format. Support to unserialize it too.
Stars: ✭ 47 (+161.11%)
Mutual labels:  json-api


GetJson

Android Arsenal API Donate stable

GetJson is the simplest HTTP library to Receive JSON Data from REST Service. It Gives data as a String which can be used to pass the data between activities which can then be converted to JsonObject to carry on further operations. It can also return data in JsonObject. It also offers an array of Internet related features.
A more advanced version of this library is DownZ.

What does GetJson do :-

  • Receives JSON Data from the REST Service with just the url.
  • Does all of this in a background thread rather than the main thread
  • Can check if Internet Connection is available or not.
  • Can also check Internet speed.
  • Can also check if the device time has been changed or not.

It uses help of a free web service provided by GeoNames. A separate registration is required to get a username and to activate the web service (Instruction in Usage)

Download

You can use Gradle

Step 1. Add the JitPack repository to your build file , Add it in your root build.gradle at the end of repositories:

allprojects {
	repositories {
		...
		maven { url 'https://jitpack.io' }
	}
}

Step 2. Add the dependency

dependencies {
        compile 'com.github.100rabhkr:GetJSON:1.0'
}

Usage

Getting JSON data from the URL

JsonObject jsonObject = new GetJson().AsJSONObject("URL");

This will return the JsonObject which can then be used to get JsonArray, Strings, etc.
Example:

try {
        JsonObject jsonObject2 = new GetJson().AsJSONObject("http://api.geonames.org/timezoneJSON?lat=47.01&lng=10.2&username=demo");
        String date = jsonObject2.get("time").getAsString();
        Toast.makeText(this, date, Toast.LENGTH_SHORT).show();
} catch (ExecutionException e) {
    e.printStackTrace();
} catch (InterruptedException e) {
    e.printStackTrace();
}

Some of the methods throw ExecutionException and InterruptedException so make sure to enclose them in a try and catch block.

Getting JsonObject as a String

String jsonString = new GetJson().AsString("URL");
//can be converted to JsonObject
JsonObject reader = new JsonParser().parse(jsonString).getAsJsonObject();

Check if Internet is available
Another feature of this library is that it checks if Internet connection is available or not so that getting data from the internet can be handled smoothly.

 Boolean isConnected = new GetJson().isConnected(Context);

Example:

if(new GetJson().isConnected(MainActivity.this)){
        try {
            JsonObject jsonObject = new GetJson().AsJSONObject("URL");
        } catch (ExecutionException e) {
            e.printStackTrace();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }else {
        //handle if Internet is not available
    }

Check Internet Speed
This Library also provides a nifty tool to check Internet Speed. It gives a basic Idea of users’ internet speed to make sure if the user has high speed internet connection or not. It returns the speed in Megabits format not MegaBytes (Mbps not MBps) in double format.

 double internetspeed = new GetJson().getInternetSpeed();

Example:

 try {
        double internetspeed = new GetJson().getInternetSpeed();
        String speed = internetspeed + " Megabits per second";
        Toast.makeText(this, speed, Toast.LENGTH_SHORT).show();
} catch (ExecutionException e) {
    e.printStackTrace();
} catch (InterruptedException e) {
    e.printStackTrace();
}

Check if device date and time is changed
User might change device time especially if it involves some kind of daily bonus. GetJson provides a little tool to check if the device’s time has been tampered with. It uses a free web service by geonames.org to do this. In order for it to work following prerequisites must be completed :-

  1. Create account here : http://www.geonames.org/login to get a username.
  2. After signing up activate your account by clicking on the link sent to your email id.
  3. Enable the free web service on your account page: http://www.geonames.org/manageaccount and Click on click to enable

Usage:

 boolean time = new GetJson().isTimeCorrect(int mode, String latitude, String longitude, String mUsername)
  • mode: It has two modes pass 0 for only checking the date and hours as some people deliberately keep their watches ahead by 5 - 10 minutes. Pass 1 to check time down to minutes.
  • Latitude and Longitude:- Pass the Latitude and Longitude in String format of the place you want to check the time for.
  • mUsername:- Pass the username you chose while signing up

Getting Help

To report a specific problem or feature request in GetJson, you can open a new issue on Github. For questions, suggestions, or even to say ‘hi’, just drop an email at [email protected]

Contributing

If you like GetJSON, please contribute by writing at [email protected]. Your help and support would make GetJSON even better. Before submitting pull requests, contributors must sign Google’s individual contributor license agreement.

If this project help you reduce time to develop, you can give me a cup of coffee :)

paypal

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].