What's the use of JSON?

Thanks all for your replies. I’ve got some studying to do, but I now see that JSON can be very useful.

3 Likes

I meant methods, not members. Something in my head kept trying to tell me that and finally I listened.

1 Like

im trying to get into what is json in real project… so you mean that json have nothing do with server, we simple store data in json file, and access needed data from json file rather from server…???

so can json communicate with database and retrieve data and update data in database…
can json read and update data in database…

Suppose we have the following CSV data.

Id,Model,ASIN,Price,Comments,HDR10
1,Samsung BD-H5900,B00KGERL3Y,219,WiFi,No
2,Sony BDPS6700,B07H47458S,144,Network,No
3,NeeGo Sony UBP-X700,B07BFHZC31,200,Network,Yes
4,Samsung UBD-M8500,B07KKW1QRL,225,No network,No
5,Sony BDP-S6500,B01E4NDS48,209,Network,No
6,LG UP870,B0795CJ3XH,259,No network,Yes

Note that that data does not use quotes to delimit text with spaces; CSV files vary in format like that.

Go to an online converter site such as Best online CSV to JSON and CSV to XML Converter/Transformer tool. There are many of them and I do not consider any to be the best. When I convert the preceding data to XML I get:

<?xml version="1.0" encoding="UTF-8" ?>
<root>
	<0>
		<Id>1</Id>
		<Model>Samsung BD-H5900</Model>
		<ASIN>B00KGERL3Y</ASIN>
		<Price>219</Price>
		<Comments>WiFi</Comments>
		<HDR10>No</HDR10>
	</0>
	<1>
		<Id>2</Id>
		<Model>Sony BDPS6700</Model>
		<ASIN>B07H47458S</ASIN>
		<Price>144</Price>
		<Comments>Network</Comments>
		<HDR10>No</HDR10>
	</1>
	<2>
		<Id>3</Id>
		<Model>NeeGo Sony UBP-X700</Model>
		<ASIN>B07BFHZC31</ASIN>
		<Price>200</Price>
		<Comments>Network</Comments>
		<HDR10>Yes</HDR10>
	</2>
	<3>
		<Id>4</Id>
		<Model>Samsung UBD-M8500</Model>
		<ASIN>B07KKW1QRL</ASIN>
		<Price>225</Price>
		<Comments>No network</Comments>
		<HDR10>No</HDR10>
	</3>
	<4>
		<Id>5</Id>
		<Model>Sony BDP-S6500</Model>
		<ASIN>B01E4NDS48</ASIN>
		<Price>209</Price>
		<Comments>Network</Comments>
		<HDR10>No</HDR10>
	</4>
	<5>
		<Id>6</Id>
		<Model>LG UP870</Model>
		<ASIN>B0795CJ3XH</ASIN>
		<Price>259</Price>
		<Comments>No network</Comments>
		<HDR10>Yes</HDR10>
	</5>
</root>

When I convert the CSV data to JSON I get:

[
	{
		"Id": "1",
		"Model": "Samsung BD-H5900",
		"ASIN": "B00KGERL3Y",
		"Price": "219",
		"Comments": "WiFi",
		"HDR10": "No"
	},
	{
		"Id": "2",
		"Model": "Sony BDPS6700",
		"ASIN": "B07H47458S",
		"Price": "144",
		"Comments": "Network",
		"HDR10": "No"
	},
	{
		"Id": "3",
		"Model": "NeeGo Sony UBP-X700",
		"ASIN": "B07BFHZC31",
		"Price": "200",
		"Comments": "Network",
		"HDR10": "Yes"
	},
	{
		"Id": "4",
		"Model": "Samsung UBD-M8500",
		"ASIN": "B07KKW1QRL",
		"Price": "225",
		"Comments": "No network",
		"HDR10": "No"
	},
	{
		"Id": "5",
		"Model": "Sony BDP-S6500",
		"ASIN": "B01E4NDS48",
		"Price": "209",
		"Comments": "Network",
		"HDR10": "No"
	},
	{
		"Id": "6",
		"Model": "LG UP870",
		"ASIN": "B0795CJ3XH",
		"Price": "259",
		"Comments": "No network",
		"HDR10": "Yes"
	}
]

All three are each a way to store data. There are advantages and disadvantages to each. JSON can do more than CSV and XML can do more than JSON. JSON can be a balance of:

  • simplicity for the computer and for people
  • usually satisfying all the requirements
1 Like

Yes, all the above can be done with JSON. You can replace a traditional database architecture completely with JSON. You can store JSON and query the storage using JSON to retrieve the stored documents. The best comparison for someone with a relational database background is MongoDB. Check out MongoDB to understand how NoSQL works with JSON. That said there are a ton of alternate relational database technologies that run on JSON. Like Open Search for searching unstructured data in JSON.

The JSON file may well be located on a server, it’s just a file and data format like CSV or XML. Also, it doesn’t do anything by itself such as reading or storing data, rather data is being read from or stored as a JSON file.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.