I have to choice to output the info in database (Mysql) to be json format.
- directly connect to database and fetch the data and output json
- connect to a REST service to get the data and output json.
Which is better and why?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you are connecting to the database (doesn’t matter if it’s MySQL or something else) directly through binary based protocol it should be faster than REST based protocol.
REST based protocols are on the other hand more simple, straightforward and easier to implement from the client side of view than binary ones in general.
It depends if you need speed or simplicity of use. In case of binary connection you would additionaly have to parse fetched data to JSON. REST service can give you usually just what you need in desired JSON format. However if speed is crucial for you then binary protocol is better choice I would say.