Some say JSON is like JavaScript.
What can this even mean?
How can a data format be like a programming language??
Also, how does JSON differ from an (algebraic) data type? Like trees.
>>8105722
yes
>>8105722
maybe
>>8105722
i dont know
>>8105722
can you repeat the question
>>8105722
YOURE NOT THE BOSS OF ME NOW
>>8105722
>Some say
who?
>>8105750
https://en.wikipedia.org/wiki/JSON
>JSON is a language-independent data format. It derives from JavaScript, but as of 2016, code to generate and parse JSON-format data is available in many programming languages. The official Internet media type for JSON is application/json. The JSON filename extension is .json.
and also
http://stackoverflow.com/questions/8294088/javascript-object-vs-json
and other questions on SE.
Doesn't make sense to me. That said, while I know some Java, I don't know more Java script than code examples on the web.
>>8105722
>Some say JSON is like JavaScript.
>What can this even mean?
Possibly they are referring to the fact that it's not a particularly efficient format, in that half the space is used to store the names of variables and sometimes white space to format it.
That's hardly a bad thing though, as storage and bandwidth is cheap and more efficient ways of storing data often fall over when you want to change what is stored while still keeping things backwards compatible. It's also still pretty efficient when compared to things like XML.
JSON = "JavaScript Object Notation". It's JavaScript's syntax for literal values (strings, numbers, arrays, and "objects" i.e. dictionaries).
In JavaScript, you can (but shouldn't) parse JSON data simply by eval()ing it. That's how JSON came into existence in the first place: as a format which can be read by JavaScript code without having to write a parser for it.
The reason why you shouldn't do that is because eval() will also execute arbitrary code, which is a problem if the data comes from an untrusted source.
The original solution was to first use a regexp to ensure that the string contained only literal values (and not function calls), and assuming that it matched, eval() it. More recent versions of JavaScript have JSON.parse().
>>8105902
For example, '{"TestValue":12345678}' takes 22 bytes to store/transfer a 4 byte value.
Again, however, this is just a guess at what could be meant by saying JSON (as a data format) is like Javascript (as a language). It's not the most efficient way to do things, but that doesn't mean it's useless.
nump