简体   繁体   中英

Data conversion logic At Client Side / Server Side

I have to some simple data format conversion. From CSV to Json. I am wondering if doing this server side or client side will make any difference ?

My use case is : I have a CSV file at server, and I am reading one row every 20 milliseconds and want to convert it to Json before it gets to the client app. So shall I convert it into Json on server side and use something I found like Json Http request to get json format data at client side. Or shall I write a javascript method to convert text format response text to json.

please suggest. Thank You!

I believe conversion logic should be done on server side. Make your client as simple and light as possible - it should get JSON from your server and simply display it via user interface. The conversion that you described is not a heavy but imagine: 1000 clients doing the same operation vs 1 server doing it and distributing to 1000 clients.

That said, if you are designing an API on server side, you should provide your data in rawest possible format. Your client servers then will have more flexibility on slicing/dicing and presenting the data for their simple UI clients.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM