[[+content_image]]
F
F
FastClick2020-01-04 17:18:44
JSON
FastClick, 2020-01-04 17:18:44

json encoding and decoding back?

I encode to JSON ( json_encode([["command" => "knopki", "knopki" => "gor_1"], "test", "white"]) ), output: [{"command":"knopki", "knopki":"gor_1"},"test","white"], then I decode what came out (as if the answer is from the database) - ( json_decode('[{"command":"knopki","knopki": "gor_1"},"test","white"]') ), outputs: Array
(
[0] => stdClass Object
(
[command] => knopki
[knopki] => gor_1
)
[1] => test
[2 ] => white
) )
how to make the last output output what was at the very beginning( [["command" => "knopki", "knopki" => "gor_1"], "test", "white"] )?

Answer the question

In order to leave comments, you need to log in

[[+comments_count]] answer(s)
G
Gleb Starkov, 2020-01-04
@colonel

json_decode('[{"command":"knopki","knopki":"gor_1"},"test","white"]', true);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question