Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options answers only not deleted user 145459

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
Accepted

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

Identify "bad JSON" lines, distinguishing between "late bad" and fatal "early bad". Report on just the top-N entries. …
J_H's user avatar
  • 34.8k
2 votes

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

obtaining minor version $targetPythonVersion = [version](python --version 2>&1 | ForEach-Object { $_ -replace '^Python\s', '' } | ForEach-Object { ($_.Split('.')[0..1]) -join '.' }) For someone w …
J_H's user avatar
  • 34.8k
2 votes

Feedback for my first project - sqlserver-json-tools

I am reading the corresponding JSON_OBJECT function: Description: This function is used to add or update a text value at the specified JSON path within a JSON object. … We pass in @JSON, which means one thing. And then we mutate and return @JSON, having an entirely different meaning. …
J_H's user avatar
  • 34.8k
8 votes
Accepted

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

Looks good to me. It's a perfectly sensible approach. There's just one line I'm going to criticize: csvfile = os.path.splitext(filename)[0] Picking off element zero is fine, no need to change …
J_H's user avatar
  • 34.8k
1 vote

Deterministically hash dictionary

convert to float elif isinstance(x, (list, tuple)): result = type(x)(_int_to_float(o) for o in x) Nice! If a key or value is subclassed, inheriting from list or tuple, then exactly the Ri …
J_H's user avatar
  • 34.8k
5 votes

JSON data format for MCQ data bank

Looking at those initial questions, conservatively we can fit at least four of them per KiB, without even gzipping the JSON indent SPACE characters. Suppose we have a RAM budget of a megabyte. …
J_H's user avatar
  • 34.8k
5 votes

Simple JSON parser in lisp

specification Please mention the URL of a JSON spec. near the top of this codebase. Extra points for mentioning the URL of some corpus of known-good and known-bad inputs you have tested against. … Similarly for "key value pair". unbalanced quotes If parse-string is given a truncated prefix of valid JSON, so there's an odd number of " quotes, it looks like it won't respond gracefully. …
J_H's user avatar
  • 34.8k
7 votes
Accepted

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

But simply data would be better, since it contains the result of a JSON parse. … It's a matter of modeling how your desired result differs from the input data that arrived in JSON form. …
J_H's user avatar
  • 34.8k
4 votes

Initializing an object using a staticmethod

input file. json loading ctor Rather than making .load() a staticmethod, you might prefer to make it an ordinary method which adds elements to your attribute containers. … So calling it several times on "in1.json" and "in2.json" would keep growing the existing containers. any other way to load the object without staticmethod? …
J_H's user avatar
  • 34.8k
2 votes
Accepted

Updating class method to use data from new weather API endpoint while keeping same return va...

This submission is about refactoring code so it will return a same-format response. Yet it did not include an automated test suite which shows Green bar on "old" code and again Green on this "new" cod …
J_H's user avatar
  • 34.8k
2 votes

Download images from an image board based on tags and blacklists

As Alex says, it looks good, but do use flake8, and consider making a generator. I get NXDOMAIN for x.json - it wasn't clear what those DNS references were supposed to do. After if __name__ == '__ma …
J_H's user avatar
  • 34.8k
1 vote
Accepted

Finding unimplemented tasks on Rosetta Code using Requests

LGTM. Ship it! There were two minor nits that seemed slightly off: The use of * in the signature to force kw args is maybe overused, as it covers args that are pretty mandatory. The print(*tasks, s …
J_H's user avatar
  • 34.8k