2

I have Email application. Currently I store all the data in MySQL database. I want to store data periodically in local file in XML or JSON format. So, when there is no database connection, I can use this local file to open and manage application locally.

I have Class Entity for each table of the database in my application and I retrieve all the data from database to Class object List.

I want to store information of email, contact and calendar in local file.

I want functionality to add/Update/delete emails, contact and calendar in local file.

Can anybody suggest me which option should I use? XML or JSON?

Nanji Mange
  • 2,155
  • 4
  • 29
  • 63
  • 2
    Please see: http://stackoverflow.com/questions/4862310/json-and-xml-comparison – Venson Nov 19 '15 at 11:42
  • 1
    JSON vs XML for local disk storage. It doesn't matter. For your purpose just use whatever is easiest for you. – CathalMF Nov 19 '15 at 11:45

1 Answers1

0

You can serialize your objects to either, so it is your choice / personal preference.

JSON has become the standard for data transfer, through the adoption of AJAX calls, although XML is still widely used.

If space is an issue, JSON uses less space.

If there is no reason to use XML, then JSON would seem like a good way to go.

Karl Gjertsen
  • 4,690
  • 8
  • 41
  • 64
  • I think both are good if data is just to add and retrieve. I also want to add and delete records in existing records. As this is big application, I want to make sure before select between XML and JSON. – Nanji Mange Nov 19 '15 at 11:54
  • If you are saving to file, there is no easier way to delete. You might need to open each file and check the details before deleting, unless you are deleting based on the file name. Although both are valid, I would go with JSON. – Karl Gjertsen Nov 19 '15 at 11:56
  • thanks for your opinion. I will definitely try. – Nanji Mange Nov 19 '15 at 12:17