Questions tagged [json]

JSON (JavaScript Object Notation) aka the Fat Free Alternative to XML is a lightweight data exchange format inspired by JavaScript object literals. It is often used with JavaScript, Ajax, and RESTful web services but is completely language independent.

Filter by
Sorted by
Tagged with
1 vote
1 answer
61 views

Apply a schema validation against an HTTP request with JSON body

...
2 votes
1 answer
48 views

Implementation of JSON schem parser to extract some attributes

I have three different types of schema possibilities as below: ...
  • 209
0 votes
1 answer
35 views

Iterating over JSON more effectively

Problem: I need to get data from JSON file containing information about "contributors". Each contributor has an atrribute jobs, which is a list of string-...
3 votes
2 answers
54 views

Saving and reading the last successful execution as a json-file

I've got some tools that run perdiodically like weekly or monthly that don't support any retry mechanism. In order to increase their chance to succeed in case a database wasn't reachable or some other ...
  • 43.9k
4 votes
1 answer
36 views

Generating a randomized JSON for testing RabbitMQ

The following code will be used to generate a random json object to be used as a RabbitMQ message body. The code works but I'm sure it can be improved in ways that I am not seeing, as I am a novice. ...
  • 41
1 vote
1 answer
37 views

Converting one JSON schema to another

Recently on Stack Overflow, a now deleted question was wondering how to convert one particular model of JSON that their code was outputting to another. The OPs main issue was that the JSON generated ...
1 vote
1 answer
57 views

Read from dynamic source and caching

I want to load JSON data from a link at the beginning of an application. I need to be a little bit about clear the following code. And also want to ask about another opinions that what could be the ...
4 votes
1 answer
52 views

Recipe website with API and JSON using vanilla JS

I'm training JavaScript and using APIs. So I'm building a recipe website that lets you search ingredients and finds you recipes with it. Here is the link: https://www.themealdb.com/ I found some code ...
1 vote
0 answers
32 views

Python - dictionaries and making a list of student enrollments [closed]

I'm new at Python and I have to make a list of student enrollments and use dictionaries within a class. I want to manage a list of exam enrollments. To do this, it is necessary to create the ...
2 votes
2 answers
113 views

Change interface depending on if statement

I'm using fiber and mongodb. Field "field" is needed to obtain certain data to unload the load on the database. If field "field" is empty, then needs to output all the data from ...
  • 23
0 votes
0 answers
59 views

Deterministically hash dictionary

I need to compute a deterministic hash for a JSON-serializable dictionary. This answer almost does the job, but there are a few problems. If dict1 == dict2 then I ...
2 votes
1 answer
75 views

Merges two OKHTTP responses into one

The first request is sent asynchronously, then the id value is taken from the response to the first request and used in the second asynchronous request. And then both responses to request 1 and ...
1 vote
1 answer
45 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 ...
  • 113
2 votes
3 answers
162 views

Deserializing Nested JSON Data with variable rootName to C# Class

I am working with JSON API data in .NET6 and was having trouble de-serializing nested data that has a variable rootname since my class type will never match what's in the JSON string. ...
  • 63
1 vote
0 answers
35 views

Transferring values from a json-string into an object-instance in nim

While writing a web application I've stumbled upon the following problem: I have a relational database. For each table with n columns I have an object-type (called ...
0 votes
0 answers
20 views

Dynamic forms with angular

I've written open source plugin for dynamic forms, you can check out the code here: https://www.npmjs.com/package/ng-formality My main concern is that as ...
  • 101
3 votes
3 answers
203 views

Json Array to ND Json converter

Problem We have a tool which produces output as json array We have another tool which anticipates input as ndjson (newline delimited json) I need to write a converter to transform json array to ...
  • 6,104
-1 votes
1 answer
109 views

Nested pojo java class - What could I make better

I need code review. I've used Lombok and jackson. Static statemts look very "ugly" in Root class. I don't know what I should make with that. Is There another way to create nested classes? ...
1 vote
0 answers
188 views

Inheriting from a JSON converter class with schema definition through constructor

I wanted to convert C++ data structures to JSON with little code. More specifically, I wanted to convert C++ data structures to nlohmann JSON representation. Project context: The goal is to use this ...
2 votes
1 answer
69 views

Javascript function which polls an async endpoint and inserts the result in a web page

I read about debounce this morning and ended up needing something similar to the concept in real life this evening to build a poll that checks whether a link I receive from an async call is ready to ...
  • 21
3 votes
0 answers
50 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 ...
2 votes
1 answer
101 views

JSON save system for Unity

I made a Json save system for my Unity game. I wanted to make something as generic as possible to keep the code DRY. I couldn't find much information online on how to make something generic. Could you ...
1 vote
1 answer
62 views

Adapter pattern apply with JsonObject

The purpose of the code is to apply adapter pattern to put an extra feature for searching through json object. I hate deep nested json object because it makes my code look messy when access through ...
  • 291
3 votes
2 answers
569 views

Download entire localStorage as file

I would like to download the entire contents from localStorage to a json file (in a "clear" formatting). I've tried this and it works perfectly. However, ...
0 votes
2 answers
59 views

JSONtab library : A tool to reversibly convert between an arbitrarily deep nested object and a tabular format

Could the following code be improved in terms of clarity, performance, maintainability, best practices etc? JSONtab library A tool to reversibly convert between an arbitrarily deep nested object and a ...
6 votes
1 answer
399 views

Elegantly combine list of records into JSON for a Python post request?

I'm parsing a Pandas DataFrame table for an API post request (using requests, of course). I'm working on building my script in Jupyter Notebooks. ...
  • 331
0 votes
1 answer
42 views

Collect values from an api more quickly

To collect the values of an api, I use three loopings, I would like to know if it is possible to improve this method that I use. a = 9625897 ...
3 votes
1 answer
175 views

How to not use the output of a function for the arguments of another function

I wrote this first function that use a JSON datafile as an input ...
  • 592
2 votes
1 answer
93 views

Using XSLT 3.0 to extract information from real-world HTML and produce JSON

For work, I extract information from HTML and XML sources to save in databases. The objective is to generate JSON representing the source document's information and its relationships in order to 1) ...
0 votes
1 answer
76 views

Extract matrices from hierarchical file structure

I have a set of JSON files stored in a folder; the folder structure is as follows: Main_folder ----F1 -----I1 ------X.json -----I2 -------X.json . . . . . . In all,...
0 votes
1 answer
196 views

Jackson deserialization of subset of enums

I have several enums that all implement this interface: public interface SelectOption { String getId(); String getLabel(); } Here's an example: ...
  • 169
3 votes
1 answer
238 views

Remove elements from JSON

This function removes a JSON element from a JSON file. In may case, the ID element. I am able to get the desired result. But the code looks very verbose; can it be written in a better way without ...
  • 133
1 vote
2 answers
151 views

group countries by language in JavaScript

I need a better implementation than the below code (O(N) Solution), I am grouping countries by language ( data ) is the countries JSON, each country could have 0, 1 .. or more language as the object ...
0 votes
1 answer
103 views

Very slow work with data analysis in JSON using Python

I'll put my complete code below so that anyone who can help won't have any difficulty running, just copy it and it's 100% functional, just very very slow. To register the data I need, I make several ...
1 vote
1 answer
72 views

Extracting data stored in a JsonDocument from an Excel file on sharepoint.com, retrieved using Microsoft Graph

I retrieve data from an Excel file located on sharepoint.com using Microsoft.Graph like this: ...
  • 10.9k
2 votes
1 answer
50 views

Achieving same abstraction by replacing JObject's implementation with System.Text.Json alternative

I'm trying to improve this wrapper by replacing the Newtonsoft.Json with System.Text.Json in its ...
  • 471
2 votes
1 answer
59 views

Handling Medium-like text editor output at backend

I'm a developer who has completed almost one year of full-stack development & learning. I published my very first package lately, and I don't know is my code good or bad. So I jumped down here. ...
0 votes
1 answer
68 views

React code that controls user permissions

I have this code that controls the user permissions provided to a user. In my case, I constructed a simple example of CRUD. When the admin checks the boxes, it will grant the user access to perform ...
2 votes
1 answer
135 views

FizzBuzz JSON via Unix socket (Go)

At heart, this program is just the basic "FizzBuzz" program. However, the program was pushed further, by making it a client-server via Unix Socket: Server run, and listening on a socket. ...
  • 23
1 vote
0 answers
47 views

Unpack a flattened hash into Hash/JSON

The following JSON ...
1 vote
0 answers
360 views

Restaurant Open Hours - Converting Json to human readable format

I am seeking a general code review. Task: Write a program that takes JSON-formatted opening hours of a restaurant as an input and outputs hours in more human readable format. Input: Input JSON ...
0 votes
0 answers
29 views

API handler to retrieve universities from MongoDB

I have this handler for my API endpoint /api/universities. My main concern is the overall quality of the code and the efficiency of my use of ...
  • 193
8 votes
2 answers
901 views

Efficiently parsing JSON response data in python

I'm using this API to get information on sports-betting odds. I am then processing it in Python to discard the irrelevant information. Here's what the response looks like: ...
  • 183
4 votes
0 answers
34 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 ...
  • 161
0 votes
1 answer
155 views

OOP Refactoring

The following script derives schemas from varied file formats. Can I get this reviewed? What would the improvements look like: ...
  • 177
3 votes
2 answers
338 views

Simple "schema validator" of JSON using JSON Patch (nlohmann::json)

Well, it's not actually a schema validator but anyway... Motivation I'm writing a library which is a UI to work with some electronics - modules. Each real module is represented by a corresponding ...
  • 771
1 vote
2 answers
108 views

Add a folder via JSON

I read about, that I only should have up to two parameters and a function should have about 10 lines. Now I am in trouble to achieve this. It is a Javascript/JSON thing in C#. I have too many ...
2 votes
0 answers
27 views

Transform dataframe to a certain JSON format

I need to go from this dataframe: ...
2 votes
2 answers
656 views

Using JavaScript, given a JSON value, recursively find all JSON objects, then sort keys in-place

Some background: JavaScript is not my primary language, so I'm looking to get some constructive criticism here. I built a tiny single page HTML app that pretty prints JSON text. It's very useful when ...
  • 131
1 vote
1 answer
3k views

Patch a JSON object using dynamic / ExpandoObject with System.Text.Json

Background Recently, I was making some updates to an "older" library that would handle PATCH-style modifications to an object that is persisted in a JSON format on our document-storage ...
  • 1,023

1
2 3 4 5
18