What is the $$hashKey added to my JSON.stringify result
I have tried looking on the Mozilla JSON stringify page of their docs as well as here on SO and Google but found no explanation. I have used JSOn stringify much time but never come across this result
I have an array of JSON objects
[
{
"param_2": "Description 1",
"param_0": "Name 1",
"param_1": "VERSION 1"
},
{
"param_2": "Description 2",
"param_0": "Name 2",
"param_1": "VERSION 2"
},
{
"param_2": "Description 3",
"param_0": "Name 3",
"param_1": "VERSION 3"
}
]
attached to my $scope and in order to POST them as one parameter, I used the JSON.stringify() method and I get the following:
[
{
"param_2": "Description 1",
"param_0": "Name 1",
"param_1": "VERSION 1",
"$$hashKey": "005"
},
{
"param_2": "Description 2",
"param_0": "Name 2",
"param_1": "VERSION 2",
"$$hashKey": "006"
},
{
"param_2": "Description 3",
"param_0": "Name 3",
"param_1": "VERSION 3",
"$$hashKey": "007"
}
]
I am just curious what exactly is the $$hashkey as I expected something more similar to the following from the stringify method:
[
{
"1":{
"param_2": "Description 1",
"param_0": "Name 1",
"param_1": "VERSION 1"
},
"2":{
"param_2": "Description 2",
"param_0": "Name 2",
"param_1": "VERSION 2"
},
"3":{
"param_2": "Description 3",
"param_0": "Name 3",
"param_1": "VERSION 3"
}
}
]
I am not sure if it is a factor but I am using Angularjs 1.1.5, JQuery 1.8.2 and Spring 3.0.4 and Spring security 3.0.7 on the Server-side
It is not causing me any issues but I would like to know the cause and reason for the $$hashkey
The $$hashkey added to json.string to keep track of your changes, so it knows when it needs to update the DOM.
Also, if you change your repeat expression to use the track by {uniqueProperty} suffix, Angular won't have to add $$hashKey at all.
For example:-
{{link.title}}