Ask a Question
Ask Question Login
Corporate Training
  1. Community
  2. Salesforce
  3. Question
Salesforce

What is the $$hashKey added to my JSON.stringify result

Asked by Fukuda Ashikaga Mar 19, 2021 1.3K views 1 answer
Share

About this question

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

Your answer

1 Answer

More Salesforce discussions

Learn & Explore

Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.

Latest Salesforce Blogs

Guides, tips and career advice on Salesforce from JanBask experts.