I have a good understanding of how to create a hashtable from scratch using jshashtable. For instance:
<script type="text/javascript" src="jshashtable.js"></script>
<script type="text/javascript">
var typesHash = new Hashtable();
typesHash.put("A string", "string");
typesHash.put(1, "number");
var o = {};
typesHash.put(o, "object");
alert( typesHash.get(o) ); // "object"
</script>
However, I am unsure about how to apply this method to my current project. I have over 1000 JSON objects similar to the following:
{
"form_key" : "basicPatientName",
"data" : "Miranda Jones",
"cid" : 2,
"pid" : 1,
"no" : "0"
},
{
"form_key" : "basicPatientGender",
"data" : "1",
"cid" : 4,
"pid" : 1,
"no" : "0"
}
My goal is to create a loop that adds all these objects to a hash table. I want to be able to search for the unique value of "form_key" and retrieve the corresponding value of "data". I understand that this process will involve using JSON.parse() in JavaScript.
For example, running alert(basicPatientName) should output "Miranda Jones".