P
P
picka2021-08-11 16:00:40
JavaScript
picka, 2021-08-11 16:00:40

How to convert json to string and back?

I use the Editor.js library, at the output it gives a JSON object, which I need to transfer to the database as a string, upon receipt, I need to convert the string back to the same JSON.
How can I implement it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Karpov, 2021-08-12
@howk

JSON -> string
JSON.stringify(object);
string -> JSON
JSON.parse(string);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question