straight MySQL results vs converted to JSON?
Is there any benefit to converting results from a MySQL query to JSON instead of just manipulating the results as they are?
I am adding features to a web frontend for a MySQL database that was written in PHP and has not been touched in at least开发者_运维知识库 5 years. I want to make it a bit more modern such as adding Ajax functionality to improve the user experience. I'm wondering if there are things that would be much easier to implement by converting results to JSON or if there are aspects of improved security that I'm not seeing.
The advantage to JSON is that it's easily understood by JavaScript since it is essentially raw JavaScript. If you already have working code that converts some other form into a form understood by your JavaScript functions, then I would say don't touch it, unless you're experiencing some sort of problem with the existing code.
精彩评论