json
#you can save only those attributes which are json serialisable only
json
#you can save only those attributes which are json serialisable only
JSON
{
"team":"My team",
"balance":1000000,
"pending_balance":0,
"payment_model":"PREPAY"
}
Json
{
"id": "1",
"name": "Peter Paul",
"description": "I will like to purchace an apple",
"price": 10,
"itemCount": 2,
"isActive": true,
"CreatedDateTime": "2021-08-06T14:23:42.483Z",
"ModifiedDateTime": "2021-08-06T14:23:42.483Z"
}
json
{
"Products": [
{
"id ": "1",
"name ": "Awesome Product 1",
"price": "28.4",
"priceAfterDiscount": "25",
"imageName": "cat1",
"isNew": "TRUE",
"ratings": "3"
},
{
"id ": "2",
"name ": "Cool Product 2",
"price": "63.9",
"priceAfterDiscount": "40",
"imageName": "cat2",
"isNew": "FALSE",
"ratings": "4"
},
{
"id ": "3",
"name ": "Amazing Product 3",
"price": "26.4",
"priceAfterDiscount": "19",
"imageName": "cat3",
"isNew": "FALSE",
"ratings": "2"
},
{
"id ": "4",
"name ": "Huge Product 4",
"price": "58.1",
"priceAfterDiscount": "50",
"imageName": "cat4",
"isNew": "TRUE",
"ratings": "4"
},
{
"id ": "5",
"name ": "Tiny Product 5",
"price": "58.3",
"priceAfterDiscount": "48",
"imageName": "cat5",
"isNew": "FALSE",
"ratings": "5"
},
{
"id ": "6",
"name ": "Expensive Product 6",
"price": "82.4",
"priceAfterDiscount": "77",
"imageName": "cat6",
"isNew": "TRUE",
"ratings": "5"
}
]
}
Json
GET https://newsapi.org/v2/top-headlines/sources?apiKey=API_KEY
JSON
private void saveUserInfo(){
dialog.setMessage("Loading");
dialog.show();
String name = txtName.getText().toString().trim();
String lastName = txtLastname.getText().toString().trim();
StringRequest request = new StringRequest(Request.Method.POST, Constant.SAVE_USER_INFO, response->{
try {
JSONObject object = new JSONObject(response);
if(object.getBoolean("success")){
SharedPreferences.Editor editor = userPref.edit();
editor.putString("photo", object.getString("photo"));
editor.apply();
startActivity(new Intent(UserInfoActivity.this, HomeActivity.class));
finish();
}
} catch (JSONException e) {
e.printStackTrace();
}
dialog.dismiss();
}, error->{
error.printStackTrace();
dialog.dismiss();
}) {
//add token to headers
@Override
public Map<String, String> getHeaders() throws AuthFailureError {
String token = userPref.getString("token", "");
HashMap<String, String> map = new HashMap<>();
map.put("Authorization", "Bearer" +token);
return map;
}
//add Params
@Override
protected Map<String, String> getParams() throws AuthFailureError {
HashMap<String, String> map = new HashMap<>();
map.put("name", "name");
map.put("lastname", "lastname");
map.put("photo", bitmapToString(bitmap));
return map;
}
};
RequestQueue queue = Volley.newRequestQueue(UserInfoActivity.this);
queue.add(request);
}
json
total_count:30,
active_count:12,
results[
{
name:StockTaking,
action:[
{
"id": 1,
"text": "A Stocktaking is created",
"is_email_subscribed": true,
"is_sms_subscribed": false,
"model_id": 1 },
{
"id": 2,
"text": "A Stocktaking is updated",
"is_email_subscribed": true,
"is_sms_subscribed": false,
"model_id": 1
}
],
count:2,
},
{
name:Live Inventory,
action:[
{
"id": 1,
"text": "A Live Inventory is created",
"is_email_subscribed": true,
"is_sms_subscribed": false,
"model_id": 1 },
{
"id": 2,
"text": "A Live Inventory is updated",
"is_email_subscribed": true,
"is_sms_subscribed": false,
"model_id": 1
}
],
count:2,
}
]
JSON
{
"message":"API endpoint not implemented",
}
json
{"request":{"type":"City","query":"Alappuzha, India","language":"en","unit":"m"},"location":{"name":"Alappuzha","country":"India","region":"Kerala","lat":"9.494","lon":"76.328","timezone_id":"Asia\/Kolkata","localtime":"2021-07-14 22:08","localtime_epoch":1626300480,"utc_offset":"5.50"},"current":{"observation_time":"04:38 PM","temperature":25,"weather_code":302,"weather_icons":["https:\/\/assets.weatherstack.com\/images\/wsymbols01_png_64\/wsymbol_0034_cloudy_with_heavy_rain_night.png"],"weather_descriptions":["Mist, Rain"],"wind_speed":6,"wind_degree":120,"wind_dir":"ESE","pressure":1008,"precip":1.7,"humidity":94,"cloudcover":100,"feelslike":27,"uv_index":1,"visibility":4,"is_day":"no"}}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us