I am here for some useful advice on how to use JSON with ajax.
I am trying to make a booking website. The back-end contains many javabeans that contain information about different aspects such as client information, booking information, location information etc. I am using JSON to serialize these beans and send them over to the client using AJAX. So basically making an ajax request and getting the serialized beans in response.
I have a complex object map (ie object A contains an instance of B as an instance variable, and B has objects C and D as instance variables and so on. All of these classes implement jsonaware interface. So when I put object A in the jsonobject everything inside it and the subsequent objects get into the object automatically. So it becomes easy when I want to send an object map.
I want to know how to make sending out information through ajax using json safe. Is it secure if I use some kind of encryption algorithm to encrypt data being sent out. I am a newbie and do not have much experience with ajax. I am sorry if I am doing something terribly amateur here ..
My confusion is between manually picking what to put in the json object( that would increase the length of my functions and also would duplicate so much code) OR to implement jsonaware and send all the information to client but have some method of securing the data.
I hope to get some tough design lessons here :) Please help me on how to handle this situation
Thanks for your help in advance. I know its a big big question to read
Use SSL to protect any sensitive information in transit.
And I think that sending data that isn't needed "just in case it might be needed in the future" is not a good approach. Send just what is needed, and in the future, when you really know what additional data you'll need, then refactor to send just what you need.