I am learning JSON, but I found out that you can put what are called “hashes” into JSON as well? Where can I find out what a hash is? Or could you explain to me what a hash is? Also, what’s a hashmap? I have experience in C++ and C#, and I am learning JS, Jquery, and JSON.
Share
A Hash is a sparse array that uses arbitrary strings/objects (depending on the implementation, this varies across programming languages) rather than plain integers as keys.
In Javascript, any Object is technically a hash (also referred to as a Dictionary, Associative-Array, etc).
Examples:
Now, since JSON is basically using JS constructs and some strict guidelines to define portable data, the equivalent to myObj above would be:
Hope this helps.