Pros and cons JSON vs XML

Just starting out? Need help? Post your questions and find answers here.
Boulcat
User
User
Posts: 28
Joined: Fri Feb 28, 2020 11:51 am

Pros and cons JSON vs XML

Post by Boulcat »

Hello to all,
My 1st post, I was able to reset my password...
Sorry for my English, I use DeepL.

I have a structured list to save or load with parents and childs.
I have not practiced either xml or json formats.
Apart from json which seems to me easier to read.
What are the cons and/or pros you see of either format and in which case choose one over the other ?
User avatar
Tenaja
Addict
Addict
Posts: 1948
Joined: Tue Nov 09, 2010 10:15 pm

Re: Pros and cons JSON vs XML

Post by Tenaja »

Boulcat wrote: Sun Apr 18, 2021 12:28 pm Hello to all,
My 1st post, I was able to reset my password...
Sorry for my English, I use DeepL.

I have a structured list to save or load with parents and childs.
I have not practiced either xml or json formats.
Apart from json which seems to me easier to read.
What are the cons and/or pros you see of either format and in which case choose one over the other ?
Json is lighter on resources, but has a few more limitations. For most applications with general requirements, if either can do it, json is preferred. This article goes a little deeper into the differences:

https://hackr.io/blog/json-vs-xml
Boulcat
User
User
Posts: 28
Joined: Fri Feb 28, 2020 11:51 am

Re: Pros and cons JSON vs XML

Post by Boulcat »

Thank you for your answer and for the link
After reading and in my case here, Json seems to be better.
For the future and to have a more global view with the dev side, let me know the limits, constraints that you have encountered

I saw this thread "Save JSON data with object members well-arranged" viewtopic.php?f=12&t=69100
I do not know if it is always current and if I should use it, my list is already sorted.
But I'm not sure how to use it with a list, It would be nice if someone could write me a small example with a structured list, as a starting point for me
Thanks
User avatar
skywalk
Addict
Addict
Posts: 3972
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: Pros and cons JSON vs XML

Post by skywalk »

Why choose either xml or json over a sqlite database file?
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
User avatar
Lunasole
Addict
Addict
Posts: 1091
Joined: Mon Oct 26, 2015 2:55 am
Location: UA
Contact:

Re: Pros and cons JSON vs XML

Post by Lunasole »

I'm preferring XML choosing between those 2. But don't see much difference and can use both, just I like XML syntax more than JSON.

skywalk wrote: Mon Apr 19, 2021 1:42 am Why choose either xml or json over a sqlite database file?
Depends on purposes, of course.
"W̷i̷s̷h̷i̷n̷g o̷n a s̷t̷a̷r"
User avatar
mk-soft
Always Here
Always Here
Posts: 5335
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: Pros and cons JSON vs XML

Post by mk-soft »

I also prefer the XML format and use it to store programme and project data.
When these are in a structure, it is very very very simple.

Example Link: https://www.purebasic.fr/english/viewto ... 12&t=74233
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Marc56us
Addict
Addict
Posts: 1477
Joined: Sat Feb 08, 2014 3:26 pm

Re: Pros and cons JSON vs XML

Post by Marc56us »

JSON format is good if you have a lot of small data.

XML format is good if you have a lot of data in each field (example: blocks of text).

An XML file can be edited easily with a text editor without the risk of destroying the structure by clumsy punctuation.

We can add:

If one then wants to do sorting and filtering easily, and the volume of data increases; SQLite is ideal.

If the data are just pairs, then the INI format (prefs) is the easiest.
ozzie
Enthusiast
Enthusiast
Posts: 429
Joined: Sun Apr 06, 2008 12:54 pm
Location: Brisbane, Qld, Australia
Contact:

Re: Pros and cons JSON vs XML

Post by ozzie »

I use XML and find it easy to work with and edit.
User avatar
Keya
Addict
Addict
Posts: 1891
Joined: Thu Jun 04, 2015 7:10 am

Re: Pros and cons JSON vs XML

Post by Keya »

just use binary storage, you'll sleep better at night even if you can't read it better during the day :)
Post Reply