Skip to content

Getting individual elements from the JSON object #44

Answered by alexzaganelli
jessecheu asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @jessecdob, you should be able to access to object keys using the dot notation or the bracket notation like this:

// dot notation
{{= USER.firstname }}

// or bracket notation

{{= USER["firstname"] }}

// or lodash .get method

{{=  _.get(USER, 'firstname', 'Guest'); }}

I think you missed the = sign after the parenthesis, which is necessary to interpolate the code. Here the docs

Ps. do you like the plugin?

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@jessecheu
Comment options

Answer selected by alexzaganelli
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants