Правильный синтаксис для моей строки JSON должен быть следующим:
Код: Выделить всё
{
"data": [
[
{
"name": "xxxx",
"city": "xxx",
"address": "xxx",
"image": "xxx",
"marketId": "1",
"products": [
"Id": "36",
"productId": "36",
"price": "120",
"discounts": "1",
"title": "xxx",
"category": "2",
"weight": "12.5",
"code": "EA123",
"isUnitized": "0",
"description": "xxxx",
"changed": "2014-04-08 15:09:16",
"units": "xxx"
]
}
]
]
Но строка, которую я получаю из кода, неправильная, вот неправильная строка (для разделения сведений о продукте требуется больше глубины):
Код: Выделить всё
{
"data": [
[
{
"name": "xxx",
"city": "xxx",
"address": "xx x",
"image": "xxx",
"marketId": "1",
"Id": "36",
"productId": "36",
"price": "120",
"discounts": "1",
"title": "xxx",
"category": "2",
"weight": "12.5",
"code": "EA123",
"isUnitized": "0",
"description": "xxx",
"changed": "2014-04-08 15:09:16",
"units": "xxx"
}
]
]
Код: Выделить всё
$this->db->select('*');
$this->db->from('markets');
$this->db->where("markets.marketId", $marketId);
$this->db->join('linkedPrices', 'linkedPrices.marketId = markets.marketId');
$this->db->join('products', 'products.Id = linkedPrices.productId');
$this->db->order_by("linkedPrices.price", "DESC");
$output[] = $this->db->get()->result();
Подробнее здесь: https://stackoverflow.com/questions/229 ... eigniter-q
Мобильная версия