Salesforce Asked by dukerok on January 8, 2021
I need to get a particular value from the JSON and store it in the variable in LWC is there any way I can do it:
asd==[
{
"ABC":"ytyffy98948",
"custui":"009686758jbnvnvm",
"CAR__c":"YUI",
"RAF__C":f,
"FAN__C":"78tu8u"
}
]
const sdfr== asd.FAN__C;
I am getting the value in sdfr
as undefined. the actual value in JSON is 78tu8u
kindly help me out for this.
Your code has a syntax error in it. You need to use a single =
sign for the assignment.
asd=[
{
"ABC":"ytyffy98948",
"custui":"009686758jbnvnvm",
"CAR__c":"YUI",
"RAF__C":"f",
"FAN__C":"78tu8u"
}
]
Also asd
is an array, not an object.
So you need to access it like below.
const sdfr = asd[0].FAN__C;
Correct answer by rahul gawale on January 8, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP