Skip to content
Advertisement

Tag: json

Saving canvas to JSON and loading JSON to canvas

I want to make it so that when I press the save button, file explorer opens and opts me to choose location to save the JSON file of the canvas. I also want to be able to load the canvas with the JSON file via the load button. How can I get started with this? Any help is appreciated. Answer

How bind data in vue.js when my key consists dash (-) in JSON data?

My JSON data looks like: How can I bind this variable with style tag for vue component? I am trying to use it in the following way, but its not working. Answer You would generally access your component’s data properties in the template by directly referring to them, without prefixing this. or data.. In your case, that’s a problem, because

D3 how to properly get the key value INSIDE of a json object

I am trying to generate my column headers based on the key value of the returned json object. However it is returning as [0,1] rather than [key[1],key[2]]. This is my json data and I’m trying to use D3 to get the key’s of this object (which is “Label”, “Count” for example) as my column headers rather than inserting it statically.

JavaScript pCloud API call to fetch userinfo gives an error

While calling the api from JavaScript This HTTP request works fine https://api.pcloud.com/userinfo?username=xxxx@gmail.com&password=xxxx In the below code I want to call via JavaScript output in console XMLHttpRequest cannot load https://api.pcloud.com/userinfo?{}. Request header field Authorization is not allowed by Access-Control-Allow-Headers in preflight response. If someone can provide a solution or enhance the code. Answer Pass the username and password in the data

JSON.parse returns string instead of object

im writing a websocket client and i would like to receive messages as json strings. For this I need a login. And if the login isn’t true i send a json string with nosuccess. JSON String: On the client I’m using this to get the string: But the type of data is a string… But why? evt.data returns: data returns:

Serializing an ES6 class object as JSON

I’d like to serialize myClass object to json. One easy way I can think of is, since every member is actually javascript object (array, etc..) I guess I can maintain a variable to hold the member variables. this.prop.foo = this.foo and so on. I expected to find a toJSON/fromJSON library for class objects since I used them with other languages

Import JSON file in React

I’m new to React and I’m trying to import a JSON DATA variable from an external file. I’m getting the following error: Cannot find module “./customData.json” Could some one help me? It works if I have my DATA variable in index.js but not when it’s in an external JSON file. index.js hobbies.js profile.js customData.json Answer One nice way (without adding

Advertisement