作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我需要帮助从 RESTful API 获取 JSON。
This is my Response
"variation_details": [
{
"variation_title": "Black Color",
"specifications": "Diamond Cut",
"image": [
"/uploads/variation-img0-0-Redmi J812127868.jpg"
],
"quantity": 10,
"price": 20000
}
],
how can i remove [] this. from response because i need to display image in view Pager
This is how i get From responsehttp://devapi.dicatto.com[/uploads/variation-img0-0-Redmi J812127868.jpg]
this is my full response
{
"code": true,
"success": "Records fetched successfully",
"result": {
"name": "Redmi J812127868",
"main_category": "5cde6e836340c5659e5c6992",
"sub_category": "5cde6f199aed456592c98f98",
"brand": "5cdeab466340c5659e5c69bd",
"model": "PROD771100",
"currency": "Rs",
"mrp_price": 18000,
"retailer_price": 17000,
"quantity": 30,
"available_quantity": null,
"avg_ratings": null,
"description": null,
"performance": null,
"other_infomation": null,
"product_description": "Test1234",
"specifications": "<p>RAM-4 </p>\n",
"features": [
{
"title": "RAM:4 GB,Memory:64 GB",
"description": "Test",
"image": "/uploads/feature-img0-Redmi J812127868.jpg"
}
],
"warranty": "12 Months",
"replacement": "Screen",
"same_day_delivery": null,
"discounted_amount": 2000,
"cash_on_delivery": null,
"manufacturing_details": "Test1232",
"importer_details": "Mumbai Test1232",
"packers_details": "Test123",
"offers": null,
"highlights": "Mumbai",
"more_info": null,
"keywords": null,
"manufacturer": null,
"variation_theme": "color",
"variation_details": [
{
"variation_title": "Black Color",
"specifications": "Diamond Cut",
"image": [
"/uploads/variation-img0-0-Redmi J812127868.jpg"
],
"quantity": 10,
"price": 20000
}
],
"__v": 0
}
}
The response change when multiple image come
"variation_details": [
{
"variation_title": "Black Color",
"specifications": "Diamond Cut",
"image": [
"/uploads/variation-img0-0-Redmi J812127868.jpg",
"/uploads/variation-img0-1-Redmi J812127868.jpg"
],
"quantity": 10,
"price": 20000
}
],
最佳答案
Variation_details.java
public class Variation_details
{
private String[] image;
private String quantity;
private String price;
private String specifications;
private String variation_title;
public String[] getImage ()
{
return image;
}
public void setImage (String[] image)
{
this.image = image;
}
public String getQuantity ()
{
return quantity;
}
public void setQuantity (String quantity)
{
this.quantity = quantity;
}
public String getPrice ()
{
return price;
}
public void setPrice (String price)
{
this.price = price;
}
public String getSpecifications ()
{
return specifications;
}
public void setSpecifications (String specifications)
{
this.specifications = specifications;
}
public String getVariation_title ()
{
return variation_title;
}
public void setVariation_title (String variation_title)
{
this.variation_title = variation_title;
}
@Override
public String toString()
{
return "ClassPojo [image = "+image+", quantity = "+quantity+", price = "+price+", specifications = "+specifications+", variation_title = "+variation_title+"]";
}
}
Variation_details.getImage()[0];您可以获取图像 key
关于java - 如何在android中获取字符串数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56438397/
我是一名优秀的程序员,十分优秀!