D
D
Dmitry2017-01-20 19:30:00
PHP
Dmitry, 2017-01-20 19:30:00

How to convert to json?

Hello!
There is a line

string(243) "[
{
"ДатаПоездки": "2017-01-16T00:00:00",
"Сюда": true,
"Обратно": false
},
{
"ДатаПоездки": "2017-01-18T00:00:00",
"Сюда": false,
"Обратно": true
},
{
"ДатаПоездки": "2017-01-21T00:00:00",
"Сюда": true,
"Обратно": false
}
]"

It does not want to be converted to json in any way. Json_decode doesn't work.
I suppose that the string needs to be converted somehow, but how?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
neol, 2017-01-20
@muldy

php.net/manual/en/function.json-decode.php
This function only works with UTF-8 encoded strings.
Do you have a string in UTF?
Well, php.net/manual/ru/function.json-last-error-msg.php

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question