K
K
kbc5902014-11-28 19:06:35
PHP
kbc590, 2014-11-28 19:06:35

How to add new value to json string using php?

There is a line.

[{"id":7,"children":[{"id":2,"children":[{"id":5}]},{"id":3,"children":[{"id":1},{"id":6},{"id":4}]}]}]

You need to add a new value, for example, at the beginning of the line.
How to properly parse this string and add a new value?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey, 2014-11-28
@kbc590

1) json_decode
2) manipulation
3) json_encode
4) profit

Q
qwestion, 2014-11-29
@qwestion

Here and there

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question