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
1answer
40 views

Generate a Json from Strings using Jackson library

I am pretty new to Java and I got a requirement of converting Strings to a json structure. My below codes works fine but I have to create multiple objects and my code looks bit ugly. I want to know ...
1
vote
2answers
347 views

Calculation with Jquery

...
2
votes
2answers
208 views

Logging the name of recipes using ingredients

Given two objects with some food data, log the name of the recipe and ingredients names separated by conjunction "and". Please run the code I have attached to see the expected output. condition - ...
7
votes
2answers
214 views

Simple console JSON formatter

I am writing simple formatter for valid JSON. Is reads JSON data from stdin and writes formatted output to stdout. Goals: given valid input produce valid formatted JSON output constant memory usage ...
6
votes
1answer
77 views

A simple BSON indenter / compacter

BSON is an extended JSON format. For example these documents are valid BSON documents, but invalid JSON documents: prettified documents: ...
4
votes
1answer
209 views

Local weather app made with Typescript

I would like feedback on my Local weather app. This site simply gets the local weather. I refactored it from jQuery to Typescript to try to learn more about Typescript. Here is a demo: https://...
2
votes
0answers
52 views

Basic to-do CLI app (with JSON for persistence) using Python

I’m very new to Python. I wanted to start out with a simple project: a CLI app that keeps track of my to-do’s. The code works as intended, but is what I have written is any good? File structure: <...
1
vote
1answer
127 views

Getting data from an API in JSON format

I'm getting data from an API in JSON format. It's getting the resting heart rate of the user and inserting it into my database. It gets today's date as well as a couple days in the past and updates ...
1
vote
1answer
2k views

Javascript Stringify Nested Objects with Loop References

I created these functions that will take any object and stringify it, and can then de-stringify it later. ...
6
votes
1answer
2k views

Iterating through nested array of objects

I have the following JSON list of objects, and I'm able to find the required object, and pass it back to the caller, given the id. Everything works fine, I'm just ...
7
votes
2answers
340 views

Parsing and creating JSON packets

For several of my pet projects, I have had to interpret and/or send JSON WebSocket or HTTP responses in Java. I did some research and picked the library GSON to use. In each project, I have ...
3
votes
2answers
2k views

Quiz app from a JSON file

My code fetches quiz data from a JSON file, displays the questions sequentially and records the user's answers. It keeps track of the user's score and at the end display the user's result based on a ...
1
vote
1answer
974 views

Accessing a list of dictionaries in a list of dictionaries [closed]

I have 4-deep JSON data structure. Basically its a list of dictionaries nested in a list of dictionaries. This is my first time working with this kind of nested data. Below I have done my best to ...
3
votes
0answers
306 views

Accessing Apixu weather API

My code is a module to simplify accessing a weather API. I'm quite certain it could be simplified, just not sure how yet. Some advice would very much be appreciated. Possibly use individual classes ...
2
votes
0answers
45 views

Controller to execute AJAX requests for a client

I have been developing this structure or pattern (I don't really know how to call it). It's my first time doing something like this, and I'm a bit worried about the future, if it becomes unmanageable. ...
3
votes
0answers
27 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: ...
3
votes
2answers
165 views

Haskell API for accessing a SQLite database

I have a SQLite database, and I'm trying to make a web API for it. I've been writing it in Haskell, and using scotty as the server. I templated out the website from ...
1
vote
0answers
62 views

Plotting neighborhood Yelp information on Google Maps

I have a project that I made a long time ago, and I was wondering how I should refactor the front end. This web app gets yelp data and displays it on a google map. I remember someone saying that html ...
3
votes
0answers
93 views

Filtering OTC market data

It's been one month I do programming in python. Hence, my experience is a bit limited. Here is what I've done so far. The program is only filtering OTC market data according to certain features. Could ...
1
vote
0answers
72 views

JSON validator using rules

I'm writing an application that is meant to validate data. The data comes in the form of JSON and I'm using JSON Schema to validate the structure and some of the logic along with functions to ...
3
votes
1answer
516 views

Script to store, search, and delete IPFS data with description in JSON file

Here is the script that I would like reviewed for the following: Best practices and design pattern usage Correctness in unanticipated cases Better dictionary access The script is made to store (IPFS)...
1
vote
0answers
65 views

Parsing JSON documents in java

I consume JSON data from Kafka Topics, and parse the JSON to create a Document ID (Unique Identifier) to persist the JSON into Elasticsearch. IDGenerator.java ...
1
vote
1answer
82 views

Parsing different json to one model

I have several json models which represent same logic model. e.g: {"title":"title1","years":"31"} and {"name":"title1","age":31} ...
3
votes
1answer
2k views

Parsing a JSON file upload

I'm trying to parse a JSON file upload. I know the format JSON will arrive as this: ...
10
votes
1answer
160 views

Merging JSON and inserting into the DOM

I'm an aspiring junior dev. This is modified version of the code I wrote for a technical interview I did today (Didn't pass. Sad.). The problem was to fetch two json files, and display their data on a ...
1
vote
1answer
72 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: ...
7
votes
2answers
625 views

Repeatable HTTP requests in Python

I have a simple python script that's repeating a HTTP response/request. I would like to know how I could have constructed this better, particularly if there's a way I could have incorporated the slice ...
0
votes
1answer
79 views

Efficiently structuring data with protocol oriented approach in Swift

I need to integrate some server API calling in which I'm likely to get response as: ...
2
votes
0answers
46 views

Display results from a JSON response based on game type

This code currently works with no errors. I want to know if there is a way to improve its conding structure, as there is a lot of repetition and it looks really bad. I tried an alternative way by ...
4
votes
1answer
62 views

Content extraction and persistence using Pandoc & Lenses

Endpoints to save a Pandoc document to the database using persistent. Prior to being stored, the code strips out all of the paragraph content (the [Inline]'s) and ...
1
vote
1answer
2k views

Creating HTML table with JSON data using pure JS

In the below function I'm fetching data from a JSON object, then creating and populating a HTML table with the contents. Yes the code is readable but I feel that it just looks too long winded for what ...
0
votes
1answer
9k 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 - ...
3
votes
1answer
636 views

Using Python to get data from a Star Wars API

I am learning Python (about 6 months in, sporadically) and today I decided to write a script to download JSON information from an API. To start, I wrote a one-page script with a few functions. The ...
1
vote
1answer
156 views

Call URL x times where x is in the JSON response after the first call

I have to make an HTTP POST request by passing header and body. In the body, I need to provide a pageNumber before posting data so I am starting with "1" initially. ...
3
votes
2answers
2k views

JSON Schema Validation helper method

This is what I wrote to validate JSON to the given schema. ...
1
vote
1answer
57 views

Setting Property Values Programmatically in a JSON Object

Through the lens of the SOLID principles, which one of the following makes the most sense? I want to ensure the approach I select keeps everything simple and maintainable as we add properties, modify ...
2
votes
2answers
94 views

Invalidate a JS Object when any of its values is null or empty

I created a simple Javascript method to recursively parse a JS Object and find out if any of its values or sub values is set to null or is empty string. I could't ...
1
vote
0answers
930 views

Fast implementation to output nested dict to JSON

Each line of the JSON has a structure looks as the following ...
3
votes
2answers
103 views

V2. Interactive dictionary with inexact look ups (updated)

Recently I published a post in which three people made pretty good suggestions. I've learnt a lot since then thanks to them! From among many things, they encouraged me to use classes. And that's ...
2
votes
0answers
137 views

EF mapping complex type to JSON in DB

I am trying to map a complex type to Json and store the info as Json in the DB using EF6 Code First. Here's what I have for now: The complex type ...
2
votes
1answer
906 views

Export running data from Garmin API to CSV

I'm interested in getting better. Current script does the job but I'm really unsure regarding Quality of overall structure & comments Error handling Possibility the add testing (what and how ...
1
vote
2answers
59 views

JSON to data structure in Javascript

I've never formally learned javascript, and I feel very much like I'm unaware of 'good' practice. I'm working on this open source project, and in particular the code that converts the incoming JSON ...
2
votes
4answers
7k views

Loading, parsing, and displaying a JSON file

I recently have been working on loading a local JSON file parsing it and displaying it using Javascript and I think I got it to where I really like it. I would like to know if anyone knows if there is ...
1
vote
1answer
28 views

Script that makes an API call to and parses the response to get a URL from where to download another file

This is my first script and I am having a hard time writing the shortest possible code. ...
2
votes
1answer
764 views

Parse heterogenous JSON array

I need to parse a JSON generated by iTunes Search API. I'm looking for all apps by a certain developer, and I usually get a response like this (simplified): ...
1
vote
2answers
685 views

Simple class to handle Json

I created a simple class which serialises and deserialises Json and C# objects. How is it looking? JsonHandler: ...
3
votes
1answer
702 views

bash script - sed - template file processing

Using a bash script to process a file and pass it to AWS CLI. The script runs inside a docker container. I'm using sed to do template string replace. When MY_VALUE ...
11
votes
3answers
8k views

Convert all CSV files in a given directory to JSON using Python

I am attempting to convert all files with the csv extension in a given directory to json with this python script. I am wondering if there is a better and more efficient way to do this? Here is my ...
9
votes
3answers
11k views

Simple JSON parser in C

Here is a simple recursive descent JSON parser, not a lot of extra functionality, although it does use the expandable vector class reviewed here (Simple expandable vector in C). I did not implement ...
0
votes
1answer
673 views

REST API design using spring boot

The following API caters to CRUD operations on users and their corresponding filters (kind of rules). These filters are applied on incoming data from various sources basing on user and then a variety ...