Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is JSONC? Are JSONC and JSON-C different?

Recently came across the term JSONC in a YouTube API. I browsed the Web, but found nothing much about it. Can someone explain whether these two are the same or different?

like image 673
Mandeep Jain Avatar asked Feb 13 '13 10:02

Mandeep Jain


People also ask

How do you comment in Jsonc?

jsonc file extension. As shown below, single line comments are prefixed by // and multiline or block comments are delimited by /* and */ .


3 Answers

There is also jsonc aka "JSON with comments", created by Microsoft and used by Visual Studio Code. The logic for it can be found here, alas without exhaustive specification (though I'd like to be proven wrong on this).

On top of that there is this project with an actual specification which is also called jsonc, but also does far more than just adding comments.

While there definitely is a use for these technologies, some critical thinking is advised. JSON containing comments is not JSON.

like image 135
Zyl Avatar answered Sep 22 '22 02:09

Zyl


JSON-C seems to just be a variation of JSON mainly targeted at C development. I.e., from the open source docs, "JSON-C implements a reference counting object model that allows you to easily construct JSON objects in C, output them as JSON formatted strings and parse JSON formatted strings back into the C representation of JSON objects."ref^1

From the YouTube API perspective (specifically, version 2, not the new version 3), The JSON-C response is just a condensed version of the JSON response (removing "duplicate, irrelevant or easily calculated values").ref^2

Why would the JSON response have "duplicate, irrelevant or easily calculated values" values anyway? Because it is converting the original ATOM XML format directly to JSON in a loseless conversion. You can find out more details here.

However, I would suggest using version 3 of the YouTube Data API. It is much easier to use. =)

like image 45
codingjeremy Avatar answered Sep 20 '22 02:09

codingjeremy


JSONC is an open-source, Javascript API created by Tomás Corral Casas for reducing the size of the amount of JSON data that is transported between clients and servers. It uses two different approaches to achieve this, JSONC.compress and JSONC.pack. More information can be found on the JSONC Github page:

https://github.com/tcorral/JSONC

like image 37
james.garriss Avatar answered Sep 24 '22 02:09

james.garriss