After calling a web service, it returns this data to me in json format.
I need to take the numeric value of $value and store it in a variable. I am working with JavaScript. Thank you
Here the json:
{"return":{"attributes":{"xsi:type":"xsd:int"},"$value":115822961}}
If what you get back is a string, you should convert it to an object to be able to access the attribute:
Now back to your case, having that structure (I organized it better using JsonLint so that the structure and its levels are more readable):
to have the value of
$value
you just have to donormally if there are no strange characters you can access the attributes of an object separating by
.
the identifiers, but for identifiers with a special character you can use['clave']
and you could bring fields with spaces for example having['mi atributo']
said that the following calls are identical: