У меня есть таблица с двумя столбцами: id (основной) и маршрут (jsonb), тип данных второго столбца - jsnob.Мой запрос, который показан ниже, работает нормально.
SELECT itinerary FROM tbl WHERE id = $x;
Результат запроса, который я получаю в контроллере, показывает тип данных как объект.Если я закодирую его с помощью json_encode (), типом данных будет строка.Что ж, моя оценка такова: я хочу, чтобы результат запроса был в формате json.Пример запроса показан ниже:
stdClass Object
(
[tour_itinerary] => [{"day": "Day One: Delhi – Nainital", "itinerary": "On reaching Delhi, meet our IHPL representative who will help you take a transfer to Nainital. En-route visit Gajraula which is well-known for its tourist destinations such as Najibudaulah’s Fort, Mandawar Ka Mahal and Raza library. After arriving in Nainital, check-in to the hotel. Nainital is a beautiful place which promises to calm your senses. Enjoy the day at any of the scenic locations of the place and relax yourself in a comfortable and calming atmosphere."}, {"day": "Day Two: Nainital - Bhimtal - Sattal- Nainital", "itinerary": "You can begin this morning with a visit to the Cheena Peak which offers a breathtaking panoramic view of the Himalayas. Spend rest of the day with a trip to Bhimtal and Sattal. Bhimtal is a scenic lakeside destination which offers a soothing environment to all the visitors.\r\n\r\nSattal is a place where seven lakes come together. The place is surrounded by beautiful green scenery. In the evening, return to Nainital and enjoy shopping at the mall road. Have a comfortable stay at night."}]
)
Быстрая помощь будет очень признательна.