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
0answers
64 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
77 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
157 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
66 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
623 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
75 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
59 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
8k 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
542 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
55 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
83 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
862 views

Fast implementation to output nested dict to JSON

Each line of the JSON has a structure looks as the following ...
3
votes
2answers
101 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
121 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
745 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
58 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
6k 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
690 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
394 views

Simple class to handle Json

I created a simple class which serialises and deserialises Json and C# objects. How is it looking? JsonHandler: ...
2
votes
1answer
656 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
9k 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
631 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 ...
2
votes
1answer
684 views

Overriding properties at runtime but not for serialization

I have a use case where I need to deserialize some settings from a JSON file and override their values at runtime but when then configuration is saved, I want to keep the original value. Imagine a ...
2
votes
2answers
510 views

Infinite scroll for currency list

I made infinite scroll for a currency (in the code below: valute) list. The currency list is fetched via an AJAX-request from a remote server. After it starts the script displays 10 records. After the ...
3
votes
2answers
68 views

Object value-column mapping

How could I improve this code to not use so many _.each calls and not always verify the object emptiness of its properties (or basically trying to make more ...
1
vote
0answers
36 views

Java Market Summary - JSON

I am writing a java program that will print current market values from a websites api. I used gson to parse the incoming json and Timer to run it every 5 minutes. I was wondering if this was the best ...
1
vote
0answers
30 views

Factory method to make JSON requests for various types of list items

I have the following code: ...
1
vote
1answer
304 views

jQuery looping on fields after validation

I have the following code: ...
1
vote
1answer
445 views

utility class for reading in JSON

I'm reasonably happy with the execution: ...
0
votes
1answer
552 views

Golang visitor pattern for marshaling shapes as JSON, and XML

I was trying to implement visitor pattern in Golang, and came across an idea of using a generic func type instead if interface ...
2
votes
2answers
110 views

Optimise many namedtuple assignment statements [closed]

I'd just like to know if there's a way I can reduce the number of namedtuple assignment statements in the code below. The actual program has over 60 assignment ...
4
votes
2answers
483 views

Python script using Minneapolis / St. Paul Metro Transit's API to tell you how long till next bus

I have written a program which will tell you how long it is until the next bus on “BUS ROUTE” leaving from “BUS STOP NAME” going “DIRECTION” using the api defined at http://svc.metrotransit.org/. ...
1
vote
1answer
154 views

Mapping JSON object to HTML

This is a continuation of previous questions. I just started using react and I've managed to fetch a xml file, convert it to json and then loop through the data. But I think there should be a better ...
2
votes
1answer
342 views

Scrape a reddit post submission for comments and save comments to JSON file (revised)

This is the revised code after incorporating the suggestions from user Roman Susi. Link to the previous post here. Notable edits: I have factored out the bigger functions into smaller tasks. The ...
4
votes
1answer
523 views

Scrape a reddit post submission for comments and save comments to JSON file

Edit: For a revision to this code according to the comments, see here: "here." In regards to the code involving shortlinks and ...
2
votes
1answer
218 views

Handling several types of messages over a web socket connection

I have a UIViewController with a Socket Connection established once viewDidLoad. This web socket is a multi-directional ...
0
votes
1answer
1k views

JSON API call in an Angular service

I have followed this format in my application to call the API and get data from it: ...
2
votes
0answers
178 views

Search GitHub users when text field changes in Kotlin Android app

Problem: Search for users by their name using the GitHub API (sorted by the number of followers) and display the results in a RecyclerView. Implementation: Hitting the GitHub API every time when user ...
1
vote
0answers
91 views

Parsing .xls database export into a JSON-formatted database import

Input: Row at index 0 is always the titles of each column. Columns will always be expected to be properly arranged for the chosen format. There may be empty or incorrectly formatted ...
0
votes
1answer
1k views

Return a Promise for a JSON POST

Given this method, we don't know which syntax is the more appropriate. ...
1
vote
1answer
43 views

Listing blog posts, each of which may belong to multiple categories

I have 3 tables like this: ...
-1
votes
1answer
59 views

Best practice to load settings to the web application

I have to load settings to an app when it's opened (It's an Electron application and I'm loading settings from the local json file) I'm loading settings right after the page is loaded: ...
1
vote
1answer
2k views

JavaScript sidebar menu with subitems from a Json Object

I'm kind of new to pure javascript and I wanted to try an exercise that I saw around the web. The exercise was to build from a json object (was not included in the exercise so I had to improvise ), a ...