360,373 questions
-1
votes
1
answer
68
views
How can I convert a JSON string, containing data for multiple dates, for use with the "popups" option in Vanilla Calendar Pro?
I am attempting to import a simple list of events as a JSON payload from a SQL Server database table into a calendar created with Vanilla Calendar Pro. Each event consists of a date and description. ...
Advice
0
votes
2
replies
83
views
Shorthand for querying JSON string inside JSON value
To obtain 1 from the following snippet, jq '.value' t.json | jq -r | jq -r '.value' is necessary:
{
"value": "{\"value\":\"1\"}"
}
Anyone know of a more ...
Advice
0
votes
2
replies
152
views
How does BaseHTTPRequestHandler send HTTP headers and JSON response body in Python?
I am learning backend development and REST APIs. I created a very small HTTP server in Python using BaseHTTPRequestHandler.
Here is my code:
from http.server import BaseHTTPRequestHandler, HTTPServer
...
Advice
0
votes
2
replies
74
views
Merge values from a JSON file into a new key-value in another JSON file
Let's say I have two files.
ip.json
{
"host1": "1.1.1.1",
"host2": "1.1.1.2",
"host3": "1.1.1.3"
}
specs.json
{
"host1&...
2
votes
1
answer
115
views
How to efficiently query nested JSON relationships (reacts_with, affected_by) without redundancy?
I am working with a structured JSON dataset where each ingredient contains relational metadata such as:
reacts_with
affected_by
compatible_with
A simplified structure is like this:
{
"...
-2
votes
1
answer
95
views
JSON Schema validation prints errors in random order
The below code validates an input JSON file against a JSON Schema. When I iterate through the validation errors it prints them in some random order which is different from the JSON fields' order. So, ...
Advice
2
votes
1
replies
155
views
What is the best way to convert a Python Lightgbm tree JSON dump into a VBA formula?
I have a LightGBM model in Python that generates a decision tree–based model for a dataset with many predictors and one response variable. I exported the model to JSON using:
model_json = lgb_model....
Best practices
1
vote
2
replies
110
views
How can I validate and pretty-print JSON in JavaScript?
I have a JSON string and I want to:
Validate if it's correct JSON
Format (pretty-print) it for better readability
What is the best way to do this in JavaScript?
0
votes
2
answers
136
views
jq getpath error: Cannot index number with string "id"
What's wrong with:
jq '[paths | select(.[-1] == "id") | {"path": ., "value": getpath(.)}]' <(echo '[{ "id": 1, "child": { "id": 2 } }]')
...
Advice
0
votes
4
replies
82
views
What is the difference between Response Body & Request Body?
I’m learning REST APIs and keep seeing the terms request body and response body.
From what I understand, both are used to send data, but I’m confused about when exactly each one is used and how they ...
3
votes
0
answers
85
views
Jackson 3 and final Map deserialization
In a corporate project, I’m migrating from Spring 3.x to Spring 4.x, and also from Jackson 2.x to 3.x at the same time.
I do have the following problem: with Jackson 2 this code works "as is"...
0
votes
1
answer
73
views
How to ensure that the HTTPServer request handler does actually write a response?
Considering the following code sample bringing up an HTTP server which handles POST requests only:
from http.server import HTTPServer, BaseHTTPRequestHandler
import json
class RequestHandler(...
Best practices
1
vote
1
replies
104
views
`jq`: cannot shorten my convoluted expression
After
curl 'https://goldbook.iupac.org/terms/index/all/json/download' --output 0.json
,
jq '.terms.list | to_entries | map(select(.value.title == "impedance")) | .[].key' 0.json
does ...
Advice
1
vote
2
replies
86
views
How to extract a value from received json field?
I am utilizing Power Automate to look at categories assigned to my emails and then push some data back to an SQL database.
I used graph explorer to help me get the right API message and have added a ...
Advice
0
votes
4
replies
94
views
Dynamic data fetching system
I am trying to write my first project using python which is a recipe administrator, which contains a programm that fetches url given a keyword, and fetches them back and add them dynamically to a ...
