Tagged Questions
2
votes
0answers
43 views
D3 Force-Directed Graph with Numerous Functionalities
I have a d3.js force directed graph that is driven by the code below. I am relatively new to d3, and much of the code is pieced together from various examples found online. If anyone has a moment or ...
3
votes
0answers
20 views
JSDoc - How to document object with generic key names? [migrated]
I already asked this question on Stack Overflow but was told that my question should rather be posted here.
I need to document an ES6 class with JSDoc that takes in an object that has properties that ...
0
votes
0answers
16 views
Leaflet app with GeoJSON data
I am working on a Leaflet app which will be displaying five layers with about 1k points each.
For our purpose (basically in order to locate most of the points near to a road) we don't want to use ...
0
votes
0answers
29 views
Remove cards on click
I am using materialisedcss and angularjs for designing my website.I have series a JSON data(from Rest) which will be displayed in the form of cards as shown below.
There will be two options which ...
3
votes
1answer
62 views
Using chartJS in Angularjs to plot IOT data
I am a Javascript and AngularJS beginner.
Below is the code inside my chartController. What this does is get IOT data from a back-end call and display it in my front-end with a chart. There are two ...
3
votes
1answer
92 views
Filtering JSON by object property value
I am attempting to filter JSON into an array of arrays containing a property value based on the product. The form is as follows:
...
3
votes
0answers
52 views
MVC JavaScript app to display athletes by country
I'm new to javascript programming and not sure if I'm coding correctly.
For testing myself I created a small JS application.
The idea of app is:
List of athletes, grouped by country and the ...
-7
votes
3answers
47 views
if inside if .. if in functional scope [closed]
I`m trying to parse a parsed xml2js response to json response in backend.
...
5
votes
2answers
83 views
JavaScript filter() on JSON object?
I'm building a web interface for a home monitoring sensor array, and fetching JSON from the backend framework. I want to start putting statistics together for monitoring different areas of the home, ...
4
votes
1answer
55 views
Sort and describe itinerary segments
Given some incoming some data in JSON format, representing unsorted train, bus, and flight tickets:
...
0
votes
0answers
31 views
Friend search by user email > returns userID > gets user details
I'm in the process of learning JavaScript and React native and I've created a friend search feature.
I'd have to say the code doesn't seem very performant as I noticed the list doesn't always ...
0
votes
1answer
53 views
Optimizing JSON append template
I am fetching a list of messages from some JSON and appending each message as an LI within a UL. I have created the message template within jQuery to append each message to the document. My code works ...
2
votes
0answers
61 views
Greasemonkey script that parses JSON to display some extra info on FamilySearch.org
This is my first Greasemonkey script and I'd like to get some comments/criticism on the code. It's pretty short so I'll just paste the whole thing here.
...
1
vote
1answer
32 views
Using JS/JQuery to serve ads from a self-hosted advertisements solution
I'm working on a custom (self-hosted) ads solution that allows the users to create ad units (by uploading the banner image and target URL) and get the ad display code. A JSON response is returned (by ...
1
vote
1answer
108 views
TypeScript JSON-Array Validator
For my latest app I wanted to be able to code the front-end first, without having to do super extensive documentation and without forgetting my data types later on while coding the back-end.
I thus ...
3
votes
1answer
206 views
Extracting JSON from string using regex
I need to get the value of item inside of this string and parse it as JSON. I've got some working code but I feel like it could be optimized (a lot) and cleaned up (a lot). Any tips or pointers are ...
0
votes
1answer
110 views
Javacript code to flatten JSON via recursion with conditional logic
I'm flattening a JSON structure where objects have their interaction type appended at the end, for use in an HTML/PDF generated file. I have variable names for Checkboxes, Text inputs, TextCheck is a ...
0
votes
1answer
59 views
Parse JSON array into different Object using Reduce
I have an script that is receiving some JSON and then I am parsing it out using reduce. I am sure there is a more elegant way to do it.
JSON
...
4
votes
2answers
60 views
Getting JSON with jQuery, creating a function that displays the data from two separate feeds
I have written my first JavaScript program from scratch and am looking for advice to check whether it is efficient and effective or how it could be improved.
...
2
votes
0answers
35 views
Cache for slow API
I work with an API which answers really slowly. I created a module which constantly asks the API and update some cached value. The code is degraded for study purposes:
...
0
votes
0answers
35 views
Implementation of dynamical forms for JSON ActiveRecord using JavaScript
I have some data in my database I store as JSON (PostgreSQL supports it). The data can be pretty flexible, something like work-experience, with names of previous companies and positions or education ...
1
vote
0answers
83 views
Filtering and hiding content with React
This is some filtering logic, according to a simple data set:
Hiding tags (entertainment types/genres) that no longer are relevant
Representing the tags on levels (according to "tagelevel")
Stopping ...
4
votes
0answers
50 views
Angular directive to fetch resources to fill a table
I created a directive that solves my immediate problem, but I'm trying to find ways to make it more reusable.
My immediate problem was, I have a table and needed to fill in one of the columns with ...
1
vote
0answers
26 views
JavaScript : Search highest ID in JSON-structure. Increment & return it
Task description:
Search the highest ID within a given JSON-structure: An array with objects as elements. Every object has a property "ID".
Then increment the highest ID and return it as a result. ...
1
vote
0answers
112 views
Populating an HTML table with JSON results
Could anyone suggest a better approach than the one I'm using now? I tried to keep it as minimal as possible, but this is the best I came up with. I did extensive research just to get to this point.
...
3
votes
1answer
91 views
Finding an object in a nested object/array structure
I have an app with a bunch of questions defined in a yaml file. For various reasons I would like the data to be divided into sections (section_0, ...
1
vote
0answers
177 views
JSON schema visualizer
I have the following backbone function to read a JSON schema and draw the tree structure (as in the screenshot below). I want to make sure if checking against the type as object/array is alright or if ...
1
vote
0answers
58 views
Sending JSON from a checkbox form
I coded this, which is working but I think there is a better way to do this.. I have a form where the user can check from checkboxes. For each checkbox I have multiple info that I want to send to my ...
1
vote
3answers
104 views
3
votes
2answers
422 views
Search and sort customers from JSON file
I have just completed my first JavaScript/jquery project. It searches customers from .JSON file and sorts them by name or ID. Everything just works fine. The thing is, I am not sure that I have ...
0
votes
1answer
65 views
List and post tasks with jQuery
I've written the code below to display a list of tasks from a Flask API. The form and associated .ajax method post to the API, immediately appending the data to the list of tasks. The code is working, ...
2
votes
1answer
399 views
Check deep object property and find duplicate value
I use the following code to find if there is duplicate value in property path:
...
0
votes
1answer
97 views
JavaScript to parse json that can be, string, object and array
I have to parse a json object that can be a string, array, array of strings and array of object. I realised that it's not good from the beginning that one object can be many types, but I can't change ...
1
vote
1answer
55 views
Interpreting the time
EDIT: Alternate answer on overflow: https://stackoverflow.com/questions/38487692/how-can-i-interpret-the-time-with-less-code/38492144#38492144
But I really want to keep Jonah's answer here too. Just ...
2
votes
1answer
1k views
Calling TWITCH API and displaying online/offline users of a channel
I've got this working almost to where I want it. The part I can't get right may be due to the programming so I'd like to get a review.
I'm making JSON calls to ...
2
votes
2answers
60 views
Retrieve data from json file and avoid HTML/JS tight coupling
I am retrieving data from a json object and even though code works I am not sure if I am following best practices.
In particular some of the objects seems too deep (like value.metadata.connections....
2
votes
1answer
27 views
An interesting use of the reduce function to convert tab-delimited data into JSON
I am learning functional programming in JavaScript. This is some code from a video tutorial by funfunfunction. I am particularly concerned about the way the existence of the customer key is checked in ...
1
vote
1answer
38 views
0
votes
1answer
70 views
Condense JSON for bandwidth efficiency
JSON is quickly becoming the formatting standard of choice for quick, convenient, and reliable machine to machine communications. It is flexible and widely supported but it has some drawbacks when it ...
1
vote
2answers
67 views
Grab photos from Flickr
I wrote the following code for a coding challenge I was given and it received the following criticism: it was quite a beginner attempt using Angular.
...
3
votes
1answer
102 views
Generating jQuery mobile “pages” dynamically
I'm doing a college assignment with jQuery Mobile and JSON. Best practice with jQuery mobile is my main concern.
My html starts off with a main 'page' (data-role="page") inside a div with id="all-...
0
votes
1answer
75 views
1
vote
0answers
44 views
Transforming a parts catalog into a different data structure
The entire purpose of this code is to arrange the data that was dumped into CommRef_ into the required structure of ResObj.
The ...
0
votes
1answer
96 views
Merging JSON objects with common values
I am trying to merge JSON objects which have common values.
This is the original JSON:
...
0
votes
1answer
734 views
Wikipedia search using the JSON API
What could I do better in my code or logic?
Wikipedia Search
...
2
votes
1answer
93 views
Regrouping JSON object
I wrote a JavaScript source which regrouping by new key i.e. following JSON to the other:
...
1
vote
1answer
108 views
0
votes
1answer
64 views
Collect several API call results
Want to brush up my rusty web dev skills. I want to call the twitch API for several channels and eventually call a callback function when all results are in without using a sync call.
I didn't work ...
3
votes
1answer
128 views
Angular JSON weather app
I'm pretty new to Angular. I wrote a weather app and need my code reviewed. I especially need help on best practices for handling edge cases on the response from the JSON endpoint.
Here's the HTML:
<...
1
vote
0answers
647 views
making dynamic tables with JSON - angular2
Okay, so simple enough task - I'm using Ionic/Angular2 to develop an auditing app. Using angular I can map Objects into the DOM rather easily, so what I need to do is create an object - but I would ...