in this json file I want to get original_ur but when i cant get it , can some one help me how to get it please
{
"orders": {
"order_items":[
{
"product_min":{
"colors":[
{
"media":[
{
"original_url": b
"https://royalpetiq.com/royalpet2/public//storage/10628/msg5212971698-890.jpg",
}
]
}
]
}
}
]
}
}
CodePudding user response:
here is your json path
x.orders.order_items[0].product_min.colors[0].media[0].original_url
CodePudding user response:
try {
var json = """{
"orders": {
"order_items":[
{
"product_min":{
"colors":[
{
"media":[
{
"original_url": "https://royalpetiq.com/royalpet2/public//storage/10628/msg5212971698-890.jpg"
}
]
}
]
}
}
]
}
}""";
var data = jsonDecode(json);
var url = data["orders"]["order_items"][0]["product_min"]["colors"][0]
["media"][0]["original_url"];
print("Url: $url");
} catch (e) {
print(e);
}
I think your json should be like that. Here the url has a b at the beginning and a comma after the url which is not the correct syntax for json
CodePudding user response:
go on quicktype id site and create model from this json after just creat object of that claass and parse this json response and after that you can get valu like x.orders.order_items[0].product_min.colors[0].media[0].original_url