Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there an alternative to the JSON format? [closed]

During Laravel installation, I ran into Composer and JavaScript Object Notation (JSON) format.

I was wondering whether alternatives to this format exist, that have the same string - value system?

like image 261
PancakesNutella Avatar asked May 31 '15 16:05

PancakesNutella


2 Answers

There are stacks of data formats that can represent data in the same way as JSON.

JSON happens to be the one that's found the most widespread acceptance, but there are plenty of others.

  • YAML uses indentation instead of braces to show nesting levels. It gives about the same features as JSON, but is intended to be more readable.
  • XML uses angle-brackets in the same way as HTML. Thanks to attributes, you can have more complex data than just simple string-value pairs. But it is less readable.
  • CSV is commonly used to import data into spreadsheets. The string-value pairs can be represented by a header row in the data.

And there's plenty of others, both standard and proprietary. You can even make up your own; as long as you can read and write it, it's a perfectly good data format. There's no right or wrong choice. But the best solution is generally to stick with the most common ones, as they'll have that much more support in the languages you're working in, and there will be more resources available for you to learn from. For my money, that makes JSON a clear winner.

In any case, when it comes to using a third-party product like Composer, you're kinda forced to use the data format of their choice, which in this case is JSON.

like image 153
Spudley Avatar answered Oct 12 '22 02:10

Spudley


One alternative could be YAML. Both JSON and YAML are human readable data interchange formats. You can find more information in the specs: http://www.yaml.org/spec/1.2/spec.html

like image 35
CairyHunts Avatar answered Oct 12 '22 03:10

CairyHunts