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.
2
votes
0answers
17 views
0
votes
0answers
24 views
Cache for slow API
I work with an API which answers really slowly. I created a module which constantly asks the API and update some cached value. The code is degraded for study purposes:
...
6
votes
2answers
28 views
Using an API to obtain JSON data and get the date string and determine if data is stale
This is a nagios check that will use an API URL, get JSON data, flatten the data into a usable perl hash, and ultimately obtain a date string. Once the date is obtained, it should recognize the ...
0
votes
0answers
19 views
Implementation of dynamical forms for JSON ActiveRecord using JavaScript
I have some data in my database I store as JSON (PostgreSQL supports it). The data can be pretty flexible, something like work-experience, with names of previous companies and positions or education ...
1
vote
2answers
51 views
Checking an authentication decision in a JSON response
I've been working on this login screen logic.
It checks for the parameters in the JSON response to decide which action to follow. It works but it's kinda ugly and verbose. Any suggestions to ...
1
vote
0answers
22 views
Filtering and hiding content with React
This is some filtering logic, according to a simple data set.
Whats the code doing?
Hiding tags (entertainment types/genres) that no longer are relevent
Representing the tags on levels (according to ...
0
votes
2answers
50 views
PHP create JSON file from Twitter API
I've been reading more on PHP JSON and APIs I wanted to play around and pull a user's tweets so I wrote a function that requires the TwitterAPIExchange wrapper.
The code:
...
1
vote
0answers
36 views
Class for managing (file I/O) data
I want to make an attempt to write my own simple RPG. As a preparation for this task I created a class which I could use to store/retrieve my in-game objects data to/from disc. I chose JSON format as ...
3
votes
0answers
29 views
Sorting upcoming events listed in JSON
I've written my first program in GO, a command line tool that parses JSON containing events from a file or from STDIN and outputs the upcoming events in sorted order. Please critique it!
...
4
votes
0answers
29 views
Angular directive to fetch resources to fill a table
I created a directive that solves my immediate problem, but I'm trying to find ways to make it more reusable.
My immediate problem was, I have a table and needed to fill in one of the columns with ...
4
votes
1answer
84 views
Testing a Pivotal API request client using lots of mocking
I have a class that is all about doing HTTP requests, and logging (in file system & database). It's only using 3 dependencies to do these things, so I'm fine with the code so far.
Here it is for ...
0
votes
0answers
23 views
Generating Django fixtures from .csv
I've written this script to create a Django .json fixture starting from a .csv.
The .csv must have 'model' and 'pk' fields. What do you think?
...
1
vote
0answers
23 views
Converting ActiveRecord array to JSON
I have two tables, devices and device_properties.
The devices table columns are as follows:
...
0
votes
1answer
47 views
Displaying a timetable
The following code displays a Timetable, but the code needs too long finish the whole process.
...
1
vote
0answers
20 views
JavaScript : Search highest ID in JSON-structure. Increment & return it
Task description:
Search the highest ID within a given JSON-structure: An array with objects as elements. Every object has a property "ID".
Then increment the highest ID and return it as a result. ...
1
vote
0answers
32 views
Populating an HTML table with JSON results
Could anyone suggest a better approach than the one I'm using now? I tried to keep it as minimal as possible but this is the best i came up with. I did extensive research just to get to this point.
...
3
votes
1answer
139 views
Displaying JSON data from a server in a UICollectionView
This code pulls JSON from a server and delivers some data like imageURL, titleString and ...
3
votes
1answer
63 views
Finding an object in a nested object/array structure
I have an app with a bunch of questions defined in a yaml file. For various reasons I would like the data to be divided into sections (section_0, ...
1
vote
2answers
72 views
Taking some JSON data, converting the date format and calculating a user average
I'm originally a Java developer taking a stab at some Scala development. One of the main reasons I'm posting is because I know that in Scala you can write your code in a Java (OOP) way and it will run ...
1
vote
0answers
54 views
JSON schema visualizer
I have the following backbone function to read a JSON schema and draw the tree structure (as in the screenshot below). I want to make sure if checking against the type as object/array is alright or if ...
3
votes
2answers
46 views
Parsing and saving JSON result from GoEuro API
I am new to python so I decided to write a script that parses a json array and writes data in a file.
I wrote the code that does that but I think it can be done way better, So I was hoping to get ...
2
votes
1answer
75 views
Loading attributes of cars and orders from JSON
I am creating an application that deals with cars and orders.
A order contains a car and other information (BUYER, OWNER, ...), which constructs an orderObject.
...
3
votes
1answer
87 views
Decoding and encoding JSON for a PHP service
I am writing a PHP service which will listen for JSON requests (made using jQuery) and will return the JSON responses.
The whole template for such services (there will be 5) I have shortened into ...
3
votes
1answer
46 views
Managing Httpcache from C# using JSON configuration
I have written an efficient way to control data to be cached/not-cached in HttpCache using JSON and C# controlling it.
The reason for this implementation is to make use of existing application ...
2
votes
0answers
19 views
Selectively flatten JSON structure
Today I spent quite some time on providing a solution for a Stack Overflow answer. It looked quite easy to me, but my solution is complex.
The question can be found here and this is my answer.
If I ...
0
votes
0answers
45 views
Sending JSON from a checkbox form
I coded this, which is working but I think there is a better way to do this.. I have a form where the user can check from checkboxes. For each checkbox I have multiple info that I want to send to my ...
2
votes
1answer
69 views
Combining json responses of recursive web service calls with PHP and curl
I'm implementing the Hotel Price List API from Skyscanner. This requires a first call to the service to implement a session followed by 1 or more calls to the service to get the actual results. I've ...
1
vote
3answers
85 views
3
votes
2answers
75 views
Search and sort customers from JSON file
I have just completed my first JavaScript/jquery project. It searches customers from .JSON file and sorts them by name or ID. Everything just works fine. The thing is, I am not sure that I have ...
2
votes
1answer
46 views
Reverse lookup ID by value
Is there a faster way of getting the key of 1 or 2 by using the accs value for my getID function? Unfortunately I cannot use an ...
4
votes
3answers
354 views
Generic WebRequest Method
I created this method to do all my WebRequests.
Generally my question is if it can be improved in any way.
As a side question, would it be better to create requests for each type (PUT, POST, GET, ...
3
votes
1answer
44 views
1
vote
1answer
98 views
Convert “spreadsheet” (flat) data into nested JSON string in PHP
Update: Based on Mike's inputs, a better version of my code can be found below (search for "better version", to skip the ugly version)
The dataset I obtain after performing a table join in the ...
4
votes
1answer
66 views
Converting Logstash YAML style configuration file into ElasticSearch Logstash JSON style config
I am new in python and have written first code to convert Logstash YAML style configuration file into ElasticSearch Logstash JSON style config. Please have a look at my piece of code and let me know ...
1
vote
0answers
17 views
Wikipath stack in Java - Part II/IV - The implicit Wikipedia article graph
This question is the continuation of the Wikipath stack series: the two classes that - given a Wikipedia article \$A\$ - return the lists of neighbour articles. The forward node expander return the ...
4
votes
1answer
71 views
Reimplemented QAbstractTableModel::setData
I have subclassed Qt QAbstractTableModel with QJsonDocument as data source which I have reimplemented the ...
6
votes
3answers
693 views
Determine if a file is either in JSON or XML format
The purpose of this function is to determine if report_input_file is either in JSON format or XML format, this is what I came up with, just want to know if this is ...
2
votes
1answer
211 views
0
votes
1answer
47 views
List and post tasks with jQuery
I've written the code below to display a list of tasks from a Flask API. The form and associated .ajax method post to the API, immediately appending the data to the list of tasks. The code is working, ...
3
votes
3answers
60 views
Reporting test results as JSON and XML
I have two functions now with very similar functionality, and would like to merge them into one more generic function. The only difference between those two functions is that one handles json input ...
6
votes
2answers
72 views
Showing virus scan results from an API and a CSV file
I am utilizing an API module for interacting with virustotal.com in order to get AntiVirus results based of SHA256 hashes. The code I have is working but I feel like it can be improved greatly. I ...
2
votes
1answer
105 views
Check deep object property and find duplicate value
I use the following code to find if there is duplicate value in property path:
...
2
votes
1answer
61 views
Simple Python script to sort and make json data unique
I'm retrieving e-mails from a collection of a few hundred *.json files using the following:
Python Script
...
1
vote
1answer
350 views
Downloading yahoo finance stock historical data as CSV using C++
This post is a continuation of my previous post where I used jsoncpp package to fetch exchange rates from fixer.io. In this post I have reused the above code and used it to fetch stock historical ...
3
votes
1answer
65 views
Fetching specific foreign exchange rates from fixer using curl and jsconcpp in C++
I am trying to create my own algorithmic trading system using C++. I have searched the web for a nice tutorial for such systems and I didnt find any. Then I started to learn about ...
0
votes
1answer
53 views
JavaScript to parse json that can be, string, object and array
I have to parse a json object that can be a string, array, array of strings and array of object. I realised that it's not good from the beginning that one object can be many types, but I can't change ...
1
vote
1answer
50 views
Interpreting the time
EDIT: Alternate answer on overflow: http://stackoverflow.com/questions/38487692/how-can-i-interpret-the-time-with-less-code/38492144#38492144
But I really want to keep Jonah's answer here too. Just ...
1
vote
1answer
59 views
Java password encryption based on time and string
I have a program that:
Takes a user specified string
Creates password from the string and previous, current, and next day
Encrypts the strings
Chops some middle characters from the strings (needed to ...
1
vote
0answers
39 views
Correct Swift Model for JSON
I am working on a program that would generate swift classes/ structures for JSON file contents.
The link to the application is Json2Model in case you want to contribute directly.
I do not know a ...
1
vote
2answers
97 views
Postman collection parser which injects collection to Jira/xray addon
I'we created an interface that communicates with Postman collection and Jira api more precise the Xray addon for jira.
I would much appreciate if you could give me notes on how to improve this code.
...