Category : json

first of all I am very bad at web programming, and i have a problem… Here is my index.js: https://pastebin.com/92SGEChN, my postBook() function: function postBook() { let bookTitle = document.getElementById("b-title").value; let bookAuthor = document.getElementById("b-author").value; let bookDesc = document.getElementById("b-descript").value; const book = { title: bookTitle, author: bookAuthor, description: bookDesc }; /// il postez fetch(‘/books’, { method: ..

Read more

I’m in the process of making my own philips hue controller via javascript. and I am trying to identify groups and light id’s. But i can’t figure out how I get the JSON id of a group or light. I get an http answer in JSON format what looks like this: { "1": { "name": ..

Read more

Im trying to pass a python dict as a json to JavaScript function. Here is the dict: dataset = { ‘labels’: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], ‘datasets’: [{ ‘label’: "test1", ‘backgroundColor’: "#54FFD820", ‘borderColor’: "#54FFD820", ‘borderWidth’: 2, ‘hoverBackgroundColor’: "#54FFD820", ‘hoverBorderColor’: "#54FFD820", ‘data’: [49, 47, 51, 48, 45, 44, 40, 42, 47, ..

Read more

I am using JSON.stringify(testObjectArray), and there are numbers with the objects. I.E) year and name. I set this data into a field in View. I get this data from a child component. this.convertedData = JSON.stringify(testObjectArray) I try to call my API with this JSON, but then it returns saying age is not a number? But ..

Read more

I want to include a code into an existing leaflet code to display a json layer. I’m using corslite script https://github.com/mapbox/corslite The following code does include the json layer into the map. function drawCanvasLayer(url) { corslite(‘myJsonFile.json’, function (err, resp) { var json = JSON.parse(resp.response); L.gridLayer.geoJson(json).addTo(map); }, true); } However in my leaflet map code I ..

Read more

i am making a Discord Bot. The bot is supposed to write to a channel specified (using a json) on which input the user gives . This is what i’ve come up with: client.on(“message”, message =>{ let parsed = JSON.parse(fs.readFileSync(‘roles.json’)); //<< Add/Remove Role >> if(message.channel.id == ‘842129346943516692’) { if(message.content.startsWith(“+”)) { var args = message.content.split(‘ ‘); ..

Read more