obtaining a value from JSON response

Dear Appery

Good morning to you and i was looking for a way to obtaining a value from JSON response. here was n elegant way to do it with localstorage.


Kateryna Grynko over 6 years ago

Here is the code:
var response = JSON.stringify(data);
localStorage.setItem( "testIt", response ); //you don't have "testit" variable so place "testit" in quotes to declare this is a string
alert( localStorage.getItem( "testit" ) ); //read saved data here.

here is my code

var onSuccessHandler = function(data) {
if (data) { //GENERATED_KEY is an object in an array
let gkey = data.map(a => a.GENERATED_KEY); //remap array
Apperyio('mmbr_id').val(gkey.toString()); //convert array to string and assign as new mmbr_id

and was wondering if there is an elegant way to without .map
Thank YOU and have a great day!


1 person has
this question