All Questions
30 questions
2
votes
0
answers
38
views
Redact specific elements from JSON (for logging)
We need to implement a simple redaction function to redact (set to undefined) certain JSON elements when logging the JSON. The requirements are:
We can't modify the current JSON object, as that ...
0
votes
1
answer
49
views
Updating class method to use data from new weather API endpoint while keeping same return value object structure as with old endpoint
I needed to update a class in Node.js that parses the response from a new weather API endpoint but still preserves the same object structure and key values from having been using the old weather API ...
0
votes
1
answer
127
views
Using JavaScript to interface with REST APIs
The website TryHackMe came up with a challenge that involves using HTTP requests to interface with REST APIs (here, task #14/day 9). The challenge basically involves querying a basic REST API to ...
1
vote
1
answer
232
views
Updating large and heavily nested JSON properties based on existing properties using nested forEach loops
The structure of the JSON is as such:
Each parent record can have many DataGroups and each DataGroup can have many ...
3
votes
0
answers
204
views
Fetch JSON from several URLs
The exercise is Write a JavaScript package that is able to:
fetch an array of URLs which contain JSON data
return their contents in a promise
I have already made a solution to this exercise, but I ...
4
votes
0
answers
56
views
Fetching data from endpoint, retrieving coordinates, then merging into an output
I'm in no way a skilled developer (or even a developer at that!) but I did want to take a go at writing a script that fetched one endpoint's data, extracted some data, sent if off to be geocoded, then ...
10
votes
2
answers
279
views
JSON4 parser in Typescript
Context
I may have accidentally gotten a little sidetracked during homeschooling, and wrote a JSON4 parser in Typescript during the down-time. This project started as an idea that I got while ...
5
votes
1
answer
768
views
AJAX with Vanilla Node.js/JavaScript – POST JSON without a form
I am new to node.js, ajax, and asynchronous code. I’ve pieced together a working way to exchange json between browser and server and am wondering if someone with more experience considers the approach ...
1
vote
1
answer
562
views
Creating a Navbar Menu from JSON data with Lodash
I am trying to create a navbar menu from JSON data. Actually I have achieved it but I am looking for feedback not to call getItems twice? How can I improve my code?
...
4
votes
1
answer
164
views
JSON to CSS in JavaScript
I'm working on a JSON to CSS converter in NodeJS, which takes a .json file and generates a .css file with its utility classes from it.
.json example
...
6
votes
1
answer
677
views
“Real world” JSON transformation using Node.js
Background
I transformed a non-trivial JSON response that uses arrays into
a nested object
eliminating some of the original properties
inserting a new summary property that is a unique list of ...
4
votes
0
answers
887
views
Node JS | From Excel to Json
Intro -> I have to convert an excel file, which comes usually in this way:
to a Json file that must looks like this:
...
3
votes
0
answers
200
views
JSON flattening with object duplication on array property for CSV generation
I am looking for a way to transform JSON data into a flat "csv-like" data object. In some way, I am looking to "sqlirize" a mongodb collection. I have already check some json flat libraries in NPM ...
0
votes
1
answer
900
views
jenkins deployment making the build very slow
I am new to Jenkins. I am doing a build through Jenkins, but the build is very slow. Is there any way I can speed it up?
...
3
votes
1
answer
1k
views
Updating entries in a JSON file
I have the following Data.json file and I would like to update some of the values.
...
3
votes
0
answers
32
views
Testing whether pages can be fetched from two ports
I have an endpoint in my API which does a port test on 4455 and 4456 once a client GET's it. This is accomplished by requesting two web pages. The result will respond to the client with a JSON object:
...
1
vote
1
answer
99
views
Avoid existSync function on Node.js - Express API controller
I have many json files that I want to serve through an API. The json files look something like this:
...
0
votes
1
answer
19k
views
Create a hierarchical tree for a JSON response
There are approx 43.000 documents (unique nodes). Building a tree structure which has 4 levels.
example of 4 different levels:
13000000 - segment
13010000 - main group
13010100 - group
13010101 - ...
0
votes
1
answer
1k
views
Return a Promise for a JSON POST
Given this method, we don't know which syntax is the more appropriate.
...
2
votes
0
answers
66
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:
...
3
votes
1
answer
107
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 ...
2
votes
0
answers
98
views
Extracting data for a tag cloud using Lazy.js
I've just started using Lazy.js, which is my first exposure to a "functional style" javascript library. I'm still utterly lost as to which of the hundred different functional javascript libraries to ...
4
votes
1
answer
495
views
Convert XML files to JSON and move them
What the code does (tested basic, no errors, usecase):
Reads all XML files (ending in .yin) from a directory.
converts each to JSON
store it in another directory, ...
2
votes
1
answer
27
views
Saving and loading parts of configuration
I have a piece of code where I have string pairs (eg. 'a' and 'AA'), where both have their own unique ids. Id for first object is configured by user and second id is received at some point during ...
2
votes
0
answers
457
views
Optimizing D3 Stream Graph Code
I have two javascript functions that generate a D3 Stream graph. I feel I may be excessively and unnecessarily iterating over my dataset to get it into the desired form.
How might I optimize or ...
3
votes
2
answers
1k
views
Generate URLs from a complex JSON object using recursion
My task is here as follows :
Input : A complex/nested JSON object with nested arrays as well
objects
Output : A JSON object that contains a set of URLs with their titles:
( key,value ) ...
6
votes
2
answers
124
views
Command line utility to output modified Markdown
What this command line utility does is to take a text file and update the content a bit before turning it into Markdown. For example, the first for loop searches all the straight quotes and replace ...
2
votes
1
answer
228
views
Node.js API route for POSTing a resource. Getting rid of callback pyramid
I'm writing an API for simple GET and POST routes. The app is a shared to-do-list. Users and lists are stored separately. A list can belong to many users, and a user can have many lists.
...
3
votes
1
answer
26k
views
Node.js JSON searching & updating
I'm working on a web-based on/off controller for multiple switches. I'm looking for a good way to manage the current state of a switch and updating the current state on change.
So far I've got a <...
2
votes
2
answers
11k
views
Populating an unordered list from values in a JSON file
I have this view that populates an unordered list from values in a JSON file, which I am doing in Node.
Is there a better way to do this, or a more 'node-like' way? Can I load the JSON file without ...