O
O
Optimus2016-07-27 07:51:59
JavaScript
Optimus, 2016-07-27 07:51:59

Parsing JSON on the frontend?

Does it make sense to get a field with the text {"a":1,"b":2,"c":3,"d":4,"e":5} (JSON) from the mysql database and return it as is. On the frontend in JS, parse and turn it into normal data to save CPU time?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anatoly Vasiliev, 2016-07-27
Pyan @marrk2

It is more logical, of course, to transfer data to the client already in JSON with a certain structure and hierarchy. In all projects that I have seen, JSON data is already transmitted to the client.
But, if there is a problem with processor time, then you can entrust these operations to the client code. JavaScript is very good at parsing a string into JSON (JSON.parse).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question