Skip to content

Instantly share code, notes, and snippets.

Niels Lohmann nlohmann

View GitHub Profile
View gist:10163930
### Keybase proof
I hereby claim:
* I am nlohmann on github.
* I am nlohmann ( on keybase.
* I have a public key whose fingerprint is 7971 67AE 41C0 A6D9 232E 4845 7F3C EA63 AE25 1B69
To claim this, I am signing this object:
nlohmann / proposal-discussion.txt
Last active Mar 1, 2017
Mail for the std-proposals forum
View proposal-discussion.txt
Hi there,
I am wondering whether JSON [RFC7159] support would be a helpful extension to the C++ standard library (pure library extension), including, but not limited to, the following aspects:
1. A variant-like container type (for this mail, let's call it "std::json") that combines C++ types for the JSON value types [RFC7159, chapter 3]:
- string (e.g. std::string),
- number (e.g., double or int64_t),
- boolean (e.g., bool),
- array (e.g., std::vector), and
- object (e.g., std::map).
nlohmann /
Last active Apr 11, 2017
Build instructions

Get the sources

git clone

Switch to feature branch

cd json
git checkout feature/manual_lexer


nlohmann /
Created Mar 12, 2018
Remove empty arrays, objects or null elements from a JSON value
def remove_empty_elements(d):
"""recursively remove empty lists, empty dicts, or None elements from a dictionary"""
def empty(x):
return x is None or x == {} or x == []
if not isinstance(d, (dict, list)):
return d
elif isinstance(d, list):
return [v for v in (remove_empty_elements(v) for v in d) if not empty(v)]
You can’t perform that action at this time.