Retrieving Values from a JSON Object in Vue.js

I'm currently utilizing Auth0, Vue.js, Vuetify, and Stripe.

Relevant code:

Here is a snippet of the JSON Object (some values have been masked):

{ "sub": "", "given_name": "", "family_name": "", "nickname": "", "name": "", "picture": "", "gender": "", "locale": "", "updated_at": "", "https://example.com/stripe_customer_id": "cus_id" }

Below is an excerpt of the HTML:

<v-chip disabled>{{ getProfile.https://example.com/stripe_customer_id }}</v-chip>
<v-chip disabled>{{ getProfile.nickname }}</v-chip>
<v-chip disabled>{{ getProfile.gender }}</v-chip>
<v-chip disabled>{{ getProfile.locale }}</v-chip>
<v-chip disabled>{{ getProfile.updated_at }}</v-chip>

The first line above doesn't function properly due to the format of the HTML link (particularly the forward slashes). Is there a method to extract the value of that specific field?

Regrettably, the key must adhere to namespace formatting requirements as per Auth0 regulations (tokens obtained from Auth0 will disregard any additional fields that are not formatted this way. I am using an Auth0 rule to generate the Stripe customer post-registration (if that detail is pertinent).

I've attempted several approaches, but all result in a raw expression error. Unsure about what steps to take next.

Is there a straightforward way to retrieve that value? Thank you in advance!

Answer №1

Utilize this code snippet:

getProfile['https://example.com/stripe_customer_id']

This method allows you to retrieve keys that contain dots or slashes. Remember, any property of a JavaScript object can be accessed using the syntax object.['key'].

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

angularjs: Include an additional column into the existing json dataset

Is there a way to dynamically add a color column to the "solutions" table using angularjs and json? I tried this code: $scope.solutions.push({"color": value2.color}); I'm using a forEach loop to dynamically decide the value of value2.color, but I wa ...

Implement AJAX functionality to showcase dictionary data retrieved through a Django view in a structured table format within the template

After browsing several posts on a similar topic, I haven't found one quite like mine. In my case, I am receiving a dictionary in JSON format from a Django view as outlined below: # showcase game statistics on the developer homepage def gamestats(requ ...

Utilizing JSON libraries to convert JSON into a Java object

Currently, I am utilizing IntelliJ Idea and Play Framework with Java. My scenario involves sending a request to the server and receiving a JSON-encoded response. However, the size of the response is extensive, and I only require one specific line from it w ...

Error Alert: The system has encountered a JSON exception with the value

I am currently working on developing a web service application that utilizes a REST API, and I am looking to test it using JSON. After running my application, I encountered the following error: D/REQUEST Result: result = {"result":[{"id":"1","name":" ...

Replace a function within the UI-Bootstrap framework

Incorporating the angular-bootstrap library into my app via bower has been a game changer. Although I am currently stuck with an (outdated) version that includes a pesky bug, upgrading is not yet feasible in my scenario. I considered inserting a customiz ...

Accessing Elements by Class Name

I've been searching for information on the capabilities of getElementsByClassName for hours. While some sources mention it returns an HTML collection of items, length, and named items, w3schools provides an example where innerHTML is utilized: var x ...

Is it feasible to integrate "tutorials" in HTML and CSS?

I have a vision to incorporate a "guider" into my application, a dialog box designed to help guide users by visually introducing them to significant features: Specifically, I am interested in functionalities like attaching the guider to an element on the ...

The appearance of SVG markers varies depending on the screen they are viewed on

Latest Update: I have finally figured out the screen issue. The device pixel ratio is to blame. Icons appear smaller on devices with lower window.devicePixelRatio. One solution I found is to adjust the icon size based on window.devicePixelRatio, like this ...

How can ember-data search for a record using both an ID and extra criteria?

While exploring the Ember documentation, I learned that the find() method supports finding by id: this.store.find('post', 1); // => GET /posts/1 It also allows for searching with arbitrary parameters: this.store.find('post', { nam ...

Transfer the iteration's value to the function's parameter

Recently delving into angular js and hoping to achieve this. Here is a snippet of my code: <tr data-ng-repeat="element in awesomeThings"> <td ng-click="getServiceDetails()"> <a href="#"> {{element}} </a ...

Using Vue.js to connect v-html to a custom CSS stylesheet

I am currently working with HTML generated by a function on an external server and I am able to preview this within a tag. Additionally, I can retrieve the CSS information in a similar manner. <template> <div v-html="html"></div ...

Activating the spinner functionality using JavaScript

Having trouble activating the spin button with JavaScript for my spinner. Any ideas on how to make it work? <!DOCTYPE html> <html lang="en"> <head> <title>My Spinner</title> <link rel="stylesheet" ...

To trigger a pop-up window displaying a link upon clicking the submit button

I am attempting to create a popup box that displays an application accepted message and a link back to the home page upon clicking the submit button. However, the .popup box is not appearing after validation. This is the content that should be displayed w ...

The Vue method is triggered multiple times during the rendering process

My goal is to design a Vuetify carousel featuring three elements in a custom component named AlbumCarousel. Each element represents an album as an albumPreview, and all albums are listed in the categorieAlbums within the data. I'm utilizing a v-for lo ...

Scrolling to does not function properly with Material UI tabs

Looking for a solution to scroll to a specific div when clicking on a tab in Material UI Tabs using UseRef and ScrollTo. Check out the sandbox link here: https://codesandbox.io/s/exciting-sound-mrw2v Currently, when I click on Tab 2, I expect it to autom ...

How does Elasticsearch utilize mapping to enhance search functionality?

After spending the past three weeks diving into Elasticsearch, I stumbled upon the topic of mapping. Specifically, I've been working on mapping the "lat" and "long" fields in my RESTful JSON data using ES with Python client. Here's the mapping I& ...

What is the process for retrieving data rows from a table using JSON format?

My experiment with long polling is successful when using a text file, but I am encountering difficulties in making it return data from a table. var timestamp = null; function waitForMsg() { $.ajax({ type: 'GET', url: 'up ...

Is there a way to eliminate a string surrounded by specific characters, like HTML tags, from a JSON file?

I am working with a JSON file that includes values for a specific string property. Within these strings, there are <a href=".... </a> tags containing various links. My goal is to iterate through the entire object and eliminate all of these tags wh ...

Troubleshooting the "Failed to mount component" error in Vue: fixing template or render function definition issues

Struggling with writing a Vue component, encountering the issue: Failed to mount component: template or render function not defined. Tried various fixes like adding default when importing the component, but none of them seem to work. My component code is i ...

Is it possible to receive live updates from a MySQL database on a webpage using node.js and socket.io?

I've been following a tutorial that teaches how to receive real-time updates from a MySQL database using Node.js and Socket.io. Check it out here: Everything seems to work fine on the webpage. I can see updates in real-time when I open the page on tw ...