K
K
Ku kuruza2020-11-03 12:33:43
PHP
Ku kuruza, 2020-11-03 12:33:43

How to form a json request correctly?

Problem with generating JSON request
It should turn out:

{
  "arr": [
    "3333"
  ]
}


I write like this:
$fields= [
  'arr' => [ '3333']
];
echo json_encode($fields)

It looks like this (and an error):
{
  "arr": [
    0 = "3333"
  ]
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
FanatPHP, 2020-11-03
@kykyruza

what?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question