XML vs JSON vs SQL

jipol

New member
Well, yes, that is the reason I considering JSON, but there are some downsides for it:
- I'll have to send the whole data array to the client, and for all cities in the world (or even in a country) that will be big data. Thus pretty heavy data exchange between the server and a client for such a minor task like selecting the shipping destination.
- This data will be used for order handling and shipping cost calculation. I consider it sensitive information, thus letting the client side to handle it can be risky.
 

ogah

New member
do you mean you store a - z data as 1 file json?
better you store your data as sql and serve as json only the city requested by clients


if your data in sql you can serve data in both xml and json, depending the request.
eg. :
Code:
http://api.yourdomain.com/shiping/?from=cityA&to=cityB&format=json&key=userkey
http://api.yourdomain.com/shiping/?from=cityA&to=cityB&format=xml&key=userkey
 
H

heiron

Guest
You can use SQL with stored procedure so the client doesn't send request to Server and if many clients connect to SQL the routine runs on Server and doesn't make use of many resources from tcp/ip connections the work is done on Server side.
 

smalpierre

New member
I would store the data in SQL, but not necessarily in a single table - actually probably NOT in a single table. Then I would use server side scripting to query the database for the particular data I needed in that instance (i.e. give me a list of city codes in Albania) and format it in JSON.

You can also write a script that reads the spreadsheet, and stores it in the database ...

It's not something you can just whip out, it'll take some dev time to do it right.
 

fouadChk

Member
smalpierre said:
I would store the data in SQL, but not necessarily in a single table - actually probably NOT in a single table. Then I would use server side scripting to query the database for the particular data I needed in that instance (i.e. give me a list of city codes in Albania) and format it in JSON.

(.................)

Best answer/solution IMHO. I do that all the time.
 

fouadChk

Member
fouadChk said:
smalpierre said:
I would store the data in SQL, but not necessarily in a single table - actually probably NOT in a single table. Then I would use server side scripting to query the database for the particular data I needed in that instance (i.e. give me a list of city codes in Albania) and format it in JSON.

(.................)

Best answer/solution IMHO. I do that all the time.

I forget to mention that the developer can cache those dynamically generated JSON to avoid re-running the same SQL queries again and again, thus avoiding putting your DB server under a lot of stress and increasing the overall performance of your App.
 

marcoxd

New member
I would probably use SQL as you can select rows without having to parse the full data in your php script.
Also, if you want to expand that you could just create more columns (or even tables) without having to write a script to update the complete file.
 

yuninho2005

New member
Hello I would like give the idea. Maybe you won't use it now but maybe later. There is a open source product called WSO2 AS thar allows to expose an Excel File as a Web service (As a Rest Service too) so you'd be able to consume the service as XML and as JSON. That technology allows you to implement SOA so maybe you can consider sometime. This is a way to expose information as a service without expending too much time writing code and is easy to redefine in the future or even replace the excel file for a data base based application without the client notice anything.

I hope this is useful.
 

MikeGao

New member
I think it really depends on what you use. I perfer sql because some of my projects require a vast amount of data, and XML & JSON just wont do the job properly.
 

rave

New member
hello
you can use sql.it is best and easy method.it is safe too. i am using sql from 10 years and not found anything wrong in it.

i will suggest you to use sql. else its your decision which u find easy and fast.
 

dpreuss

New member
I would more concentrate on the whole workflow. If the XLS files are changing often, I would create a VBA script to load the XLS sheets and to export several JSON files.
 

computernerd365

New member
JSON is better for client-side while SQL is more server-side because of it's use in server data storage, but they both can be used pretty well together or as opposites of which I just said before