1

i have this data in json

    {
    name: "Contract information", 
    description: "Contract information", 
    created_at: "2021-08-23 09:40:42", 
    updated_at: "2021-08-23 09:41:07", 
    sender_id: 8, 
    chat: false, 
    videocall: false, 
    meeting: true
}

i want show in front end with vuejs the chat, videocall and meeting, but not true/false but the key (chat, videcall, meeting)

i tried to do this :

    <b-button variant="outline-primary my-2 mx-1" style="cursor: default">
            <strong> Contact:</strong>
            {{getConsultancy.meeting) }}
    </b-button>

but it show me the values true/false how can i do show only the key?

2 Answers 2

1

I may have understood wrong but,

This code will give you real value keys but not the booleans

Object.keys(yourObject).filter(key => (typeof yourObject[key] != "boolean"))

Or If you just want to keys you can use

Object.keys(yourObject)
Sign up to request clarification or add additional context in comments.

Comments

0

To get the Key you can do it with Object.keys(getConsultancy) or Object.keys(getConsultancy.meeting)

See Docs here: https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Global_Objects/Object/keys

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.