Skip to main content

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
2 votes
0 answers
30 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 ...
lincolnadym's user avatar
5 votes
2 answers
307 views

Simple JSON parser in lisp

A simple recursive descent JSON parser. The entrypoint to the code is the parse function. Since I'm pretty new to common lisp, I wanted to get feedback on how to ...
zoravur's user avatar
  • 51
-3 votes
1 answer
79 views

Initializing an object using a staticmethod

I've an object that looks like this, and users have been populating the attributes post-initialization, e.g. ...
alvas's user avatar
  • 699
4 votes
2 answers
691 views

What is the best way to set a class value to a variable in Python if it exists in a dictionary?

I have this code which sets values in a location class from values from JSON data. ...
Asher Ross's user avatar
6 votes
4 answers
728 views

JSON data format for MCQ data bank

I'm creating a data bank of MCQ (Multi Choice Questions) and their answers so that an app can be built around it. Regarding the actual storage format, I have two ideas: An array of objects with keys (...
Prahlad Yeri's user avatar
0 votes
1 answer
80 views

Feedback for my first project - sqlserver-json-tools

could you review my first project on github please. The JSON_MODIFY function in SQL Server 2016 and 2019 does not allow creating paths dynamically, making it necessary to chain JSON_MODIFY executions. ...
Renato Magalhães's user avatar
1 vote
0 answers
134 views

Json4 parser in Typescript - Optimized

Context This review-request is a follow-up to this question. After the initial implementation, which focused on spec-compliance mainly, I have made some revisions to improve the performance of the ...
Patrick Hollweck's user avatar
3 votes
1 answer
60 views

PowerShell Script for Parsing JSON PyPI Package Data and find the latest version

Following this post, I have a PowerShell script that aims to interact with the Python Package Index (PyPI) to find the latest release of a specified package that is compatible with the current Python ...
Foad's user avatar
  • 361
4 votes
1 answer
98 views

Java classes for downloading all in-coming/out-going links of an article in the Wikipedia article graph

(The entire project is in GitHub.) Introduction This project provides facilities for generating in-coming or out-going links in a given Wikipedia page. Code ...
coderodde's user avatar
  • 29.1k
0 votes
1 answer
48 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 ...
Aaron Goldsmith's user avatar
4 votes
2 answers
125 views

Fetch a Quranic Verse from the Web

Verse is a command-line program that allows you to retrieve specific verses from the Quran. It takes a chapter and verse number as input and provides you with the corresponding Quranic verse. ...
Harith's user avatar
  • 9,687
1 vote
0 answers
36 views

caching and rendering blog posts in markdown in react

I'd like to know if I'm doing this badly or involving any antipatterns. Masterlist.json contains a list full of all of the posts that exist and should be fetched on the page. Post metadata is ...
shr4pnel's user avatar
1 vote
0 answers
107 views

Better way to parse data from nested JSON in Javascript/ NextJS

The nested JSON file contains names of US states and corresponding cities. City.json ...
aries0152's user avatar
  • 181
3 votes
1 answer
302 views

Bash scripts to convert json to associative arrays and then back to json

I'm a relative bash novice but have found it along with jq a great way to manipulate json scraped from various sources. I couldn't find any ready-made scripts to convert arbitrarily deep json to bash ...
joeblog's user avatar
  • 243
3 votes
1 answer
255 views

Find the closest named color

I have a .json file with name (string) and RGB (r, g, b: numbers) with 30.000 key-value pairs. I am looping the json multiple times per second to find the closest name to a given RGB color. Any idea ...
Relik8's user avatar
  • 31
3 votes
1 answer
164 views

parsing json file with potential corrupted record and sorting by id to output first n lines - cleaner logic

messy json file is parsed and should output the N highest record IDs & scores by score in descending order, highest score first. the code works but i wonder if there is better readability, help me ...
ERJAN's user avatar
  • 887
1 vote
0 answers
171 views

Wrapping an ExpandoObject within a SafeExpandoObject

I've written code to deserialize a JSON into an ExpandoObject. The only problem with the ExpandoObject is that if you try to access a member which doesn't exist, it ...
rboy's user avatar
  • 111
1 vote
2 answers
95 views

Update JSON object in outer object or insert a default one

The below code is part of a program that, among other things, configures a Chromium profile: ...
Richard Neumann's user avatar
3 votes
2 answers
183 views

Enum to deserialize HTML sizes from JSON with serde

I added an enum for my webscraper to deserialize data from a JSON field that represents an HTML image size, which can either be an unsigned int like 1080 or a ...
Richard Neumann's user avatar
3 votes
1 answer
282 views

JSON comparison function

I've written a comparison function between two json values. I'd like to know if it can be improved at all in any way. Thanks again for the help. ...
David542's user avatar
  • 429
1 vote
0 answers
23 views

Designing a font definition with multiple variants per glyph

My project penhand tries to visualize the process of writing with a pen. Part of the project is an engine that converts text entry into a sequence of glyphs that are then rendered as animation into a ...
ccprog's user avatar
  • 151
1 vote
0 answers
24 views

Use API data to ensure current product prices in database data then sort by price

Because I've waited until now to bother learning the magical JSON functions that modern MYSQL affords, I wonder if my code is optimally written and if there are cautions/limitations to be aware of. My ...
mickmackusa's user avatar
  • 8,684
3 votes
1 answer
890 views

"Fixing" broken JSON with unescaped quotes

This code is supposed to fix JSON structures that are broken by having unescaped quotes in strings and try to recover if possible. The code can only recover on certain cases and can be fooled by ...
K.H.'s user avatar
  • 2,678
0 votes
1 answer
125 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 ...
Aleksey's user avatar
  • 183
2 votes
0 answers
146 views

Python raw dataclass to formatted dataclass transformation for avro schema

I receive some data from an api. I would like to define the raw responses schema and model it as a python dataclass, with the added benefit of using the ...
bbd108's user avatar
  • 121
4 votes
1 answer
1k views

JSON value with std::variant

For learning purposes, I wanted to implement a class that could hold JSON data with std::variant. Most of the implementations I found online were using incomplete types as template arguments for map, ...
adepierre's user avatar
  • 115
2 votes
0 answers
125 views

Python code to add GeoIP data to a Suricata eve.json log

I wrote this script as part of a Suricata course where I had to annotate destination IP addresses with GeoIP data in an EVE JSON log file. I would like your input on my code style and smell, ...
Devilish Spirits's user avatar
2 votes
2 answers
2k views

Created structured/nested JSON from unstructured JSON

I have below unstructured but valid JSON which need to be converted to structured format ...
Pranav Bilurkar's user avatar
3 votes
1 answer
1k views

Insert json object into existing Json array

I have created a tool to insert JSON objects with several rules: Read the product status, and then insert based on the status If there is no data in this status, then insert the object If there is ...
ilham ramadhan's user avatar
3 votes
1 answer
53 views

Optimizing code for this function that filters a JSON file

I made a function that turns all child from a JSON file to parents (or brothers?). It adds the parent name to the key, so there are no duplicates. It works ok, but I would like to ask if there are ...
Albert's user avatar
  • 31
2 votes
2 answers
91 views

delete multidimentional array value in php

I made a program that converts JSON to a PHP array and checks every value of the multidimensional array with a loop and if a value matches certain values then it deletes that key and value and ...
mahmoudkhani's user avatar
6 votes
2 answers
887 views

Extract data from api using shell scripting

So we have many vlans at work, often it is nice to see which ip ranges are associated with said vlan. We have a well developed api for displaying information about our network and thus I wrote a small ...
N3buchadnezzar's user avatar
2 votes
2 answers
643 views

Apply a schema validation against an HTTP request with JSON body

...
Cengiz Ergün's user avatar
2 votes
1 answer
77 views

Implementation of JSON schem parser to extract some attributes

I have three different types of schema possibilities as below: ...
ParthS007's user avatar
  • 197
0 votes
1 answer
49 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-...
JoshJohnson's user avatar
3 votes
2 answers
89 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 ...
t3chb0t's user avatar
  • 44.3k
4 votes
1 answer
69 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. ...
Johnny's user avatar
  • 41
1 vote
1 answer
1k 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 ...
SomeStudent's user avatar
1 vote
1 answer
77 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 ...
Neslihan Bozer's user avatar
4 votes
1 answer
318 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 ...
emma673r's user avatar
2 votes
2 answers
122 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 ...
Boro8ey's user avatar
  • 23
3 votes
1 answer
431 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 ...
actual_panda's user avatar
2 votes
1 answer
194 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 ...
Anne Maier's user avatar
1 vote
1 answer
227 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 ...
Faahmed's user avatar
  • 113
2 votes
3 answers
2k 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. ...
Phexyaa's user avatar
  • 63
1 vote
0 answers
98 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 ...
Philipp Doerner's user avatar
4 votes
3 answers
836 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 ...
Peter Csala's user avatar
  • 9,486
0 votes
1 answer
2k 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? ...
popMichael's user avatar
1 vote
0 answers
583 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 ...
RicardoO's user avatar
2 votes
1 answer
188 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 ...
Dozie's user avatar
  • 21

1
2 3 4 5
18