V
V
Vitaly2017-06-13 17:55:21
PHP
Vitaly, 2017-06-13 17:55:21

How to make a form to add entries in json?

There is a JSON of the form: {"Question 1":"Answer 1","Question 2":"Answer 2"}
How to make a form that would add the values ​​​​of two fields to this JSON?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
ipokos, 2017-06-14
@ipokos

Существует JSON вида :{"Question 1":"Answer 1","Question 2":"Answer 2"}

Например:
$your_str = '{"Question 1":"Answer 1","Question 2":"Answer 2"}'
$your_array = json_decode($your_str);

получаете массив.
Работаете с массивом, добавляете что нужно,
после этого:
Преобразовываете обратно

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question